Input renders a text input and accepts native input attributes such as type, name, required, disabled, and autoComplete.
Usage
Uncontrolled state
UsedefaultValue to set the initial email address. The input owns subsequent changes.
Visual choices
Compare small and medium inputs in their default, focused, invalid, and disabled states. Use validation feedback alongside invalid styling.Controlled state
Passvalue and update it with onValueChange to own the same email address in React state. The callback receives the next string value and event details.
Add an adornment
InputGroup owns the surrounding border and layout height. Input size resolves from the explicit child size, then the group default, then md. The grouped input stretches within the shared border, so use the group’s size to change the overall field height.
Native control and wrapper customization
Native attributes, handlers,className, style, and ref target the input. The ref receives an HTMLInputElement. Use render to compose another input component and forward the supplied props and ref to its native input.
onChange receives a React change event for the native input. onValueChange(value, details) receives the next string and Base UI event details, including event, reason, cancel, and allowPropagation. The event targets the input. Canceling the details preserves Base UI’s validation policy; it does not undo a native edit. Controlled callers decide which value to commit.
Put layout styles, attributes, and refs on InputGroup when customizing the surrounding wrapper. The group owns no value. Native name, form, required, readOnly, disabled, submission, and reset behavior remain on the input, with Field naming and validation supplied through Field.Root.
Props
The reference includes component-specific and inherited Base UI props. Native input attributes are also accepted. A standalone input defaults tomd; inside a group, an omitted input size inherits the group’s size.
string | ((state: InputState) => string | undefined)
CSS class applied to the element, or a function that
returns a class based on the component’s state.
string | number | readonly string[]
The default value of the input. Use when uncontrolled.
((value: string, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)
Receives the next string value and Base UI details, including the native event, reason and cancellation methods.
Ref<HTMLInputElement>
Ref to the native input element.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, InputState>
Composes the native input with a custom element or render callback. Forward the supplied props and ref to an input.
"md" | "sm"
Visual size. Explicit input size takes precedence over the InputGroup default, then md applies. Group layout still sets the surrounding height.
CSSProperties | ((state: InputState) => CSSProperties | undefined)
Style applied to the element, or a function that
returns a style object based on the component’s state.
string | number | readonly string[]
The value of the input. Use when controlled.