Input
Single-line text field, for use inside a Form.
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
Input is a pure field declaration — no onChange / controlled value. It renders to the native ModalFormData.textField control; the result (string) arrives at values[name] in the form's onSubmit, once, on submit.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
name* | string | — | Result key — the value appears at values[name] in the form's onSubmit |
placeholder | string | — | Text shown inside the native field when empty |
defaultValue | string | '' | Initial text |
font | TextFont | 'mojangles' | Font family for the typed value and placeholder |
scale | number | 1.0 | Scale multiplier relative to the standard glyph size |
textOffsetX / textOffsetY | number | 8 / vertically centered | Typed-value position offset (px) from the box's left-middle frame |
placeholderOffsetX / placeholderOffsetY | number | 8 / vertically centered | Placeholder 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. - Keep
namestable across renders; it's the only key you get back on submit. - For themed screens, prefer
@bedrock-core/ore-styled'sInputover styling this primitive by hand.
Limits
Modal-only. The engine draws no text field on an action form or a container screen, so writing one there is a build error naming the fix rather than a control drawn inert. <Toggle> and <Select> are the controls that serve all three hosts.