Skip to main content

Input

Single-line text field for a Form or Experimental_OreUI screen.

Import​

import { Form, Input } from '@bedrock-core/ui';

Usage​

<Form onSubmit={v => console.warn(v.nickname)}>
<Input name={'nickname'} placeholder={'§7type here'} />
<Form.Button type={'submit'}>{'Save'}</Form.Button>
</Form>

How it works​

Inside Form, the native text field reports a string at values[name] on submit. Inside Experimental_OreUI, value controls the text and onChange receives live edits. Without value, the live field retains internal state initialized by defaultValue.

Props​

PropTypeDefaultDescription
namestring—Required result key inside Form; optional on an Ore screen
valuestringinternal stateControlled text on an Ore screen; modal forms use defaultValue
onChange(value: string, event: UiEvent) => void | Promise<void>—Receives live Ore edits and the owning player's event
placeholderstring—Text shown inside the native field when empty
defaultValuestring''Initial text
fontTextFont'mojangles'Font family for the typed value and placeholder
scalenumber1.0Scale multiplier relative to the standard glyph size
textOffsetX / textOffsetYnumber8 / vertically centeredTyped-value position offset (px) from the box's left-middle frame
placeholderOffsetX / placeholderOffsetYnumber8 / vertically centeredPlaceholder position offset (px), same frame as the typed value

The box uses background/backgroundHover/backgroundPressed/backgroundLocked for per-state texturing — the same shape as Button; backgroundPressed doubles as the focused-field state.

Inherits control props.

Examples​

Basic input​

<Input name={'nickname'} placeholder={'§7type here'} />

Two inputs side by side​

<Panel flexDirection={'row'} gap={4}>
<Input name={'first'} placeholder={'§7first'} flex={1} />
<Input name={'second'} placeholder={'§7second'} flex={1} />
</Panel>

Notes​

  • Always provide a placeholder — it's the only hint the player gets about what to type.
  • Inside Form, keep name stable across renders; it identifies the submitted value.
  • For themed screens, prefer @bedrock-core/ore-styled's Input over styling this primitive by hand.

Limits​

Supported inside Form and Experimental_OreUI. Action forms and container screens refuse text fields at build time. The Ore host requires version-matched client resources.