Input
A single-line text field, with icons and an optional clear button.
Usage
Input is a styled text field built on Base UI's Input. Use it like a native <input> — every native attribute (type, value, onChange, name, …) passes straight through. Give it a label the usual way: an external <label htmlFor> pointing at its id, or an aria-label.
Add an icon or prefix with startSlot / endSlot, and a clear button with clearable. When any of those are present, Input renders a wrapper around the field so the adornments sit inside the same frame; otherwise it renders the bare input.
Examples
Variants
variant switches the appearance between a bordered outline (default) and a filled soft field.
Sizes
inputSize scales the height, padding, and text — sm, md (default), or lg. (It's named inputSize so it doesn't collide with the native size attribute.)
Start & end slots
startSlot and endSlot take any node — not just icons — and render it inside the field frame. Use them for a leading icon with a static text suffix, an Avatar, or an interactive control like a password-visibility Button.
Clearable
Set clearable to add a clear (✕) button that appears once the field has a value and empties it on click. Pair it with onClear to react to the reset.
Disabled, read-only & error states
disabled greys out the field and blocks interaction; readOnly keeps it focusable and selectable but prevents edits. Set aria-invalid to paint the error state — it's mirrored to data-invalid. Inside a Field, the input also inherits the field's disabled and invalid state, which is the better choice when you're rendering a validation message.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and the like — follows the same direction.
The text aligns to the start edge and the startSlot/endSlot adornments swap sides to follow the resolved direction. For setup details and caveats, see the RTL guide.
API reference
Input wraps Base UI's Input and forwards every remaining native <input> prop (type, name, onChange, aria-*, …); the variant, inputSize, clearable, startSlot, endSlot, onClear, and inputProps props are Appica additions. Inside a Base UI Field it picks up the field's disabled and invalid state, and exposes data-disabled / data-invalid for styling.
When adornments or clearable are present the field renders inside a wrapper, so className lands on that wrapper. Use inputProps to reach the inner <input> itself (for example to give it its own className).
Accessibility
- Renders a native
<input>(role="textbox"). Give it an accessible name — an external<label htmlFor>pointing at itsid, or anaria-label. - The clear button is labelled Clear input, kept out of the tab order (
tabIndex={-1}), and appears only when the field has a value. aria-invalidis bridged todata-invalidso the error state styles with or without a wrappingField.disabledremoves the field from the tab order and exposesdata-disabledfor styling.