Input Group
A text input that shares one surface with a prefix, suffix or action.
The https:// prefix is not part of the value.
Usage guidelines
- Use
InputGroupwhen one text input shares its visual surface with a prefix, suffix or action. Use the standaloneInputwhen nothing shares the surface, and do not absolutely position content over anInputto recreate one. - Place the input before every addon in the DOM. The input is the primary control and addons are read or reached after it; only decorative
aria-hiddencontent may come first. Setalign="inline-start"(the default) oralign="inline-end"on the addon for its visual position; it does not change reading or focus order. - Give
InputGroupInputan accessible name from a visible label,aria-labeloraria-labelledby. Wrap the group inFieldwith aFieldLabelfor a form row;Fieldalso supplies the name, validation, description and error. - Field state reaches
InputGroupInput, and the group derives its invalid, disabled, read-only and focus visuals from that direct input. Do not repeat those states on addons or restyle them on the group. - Treat addon text and icons as supporting content, and mark decorative icons
aria-hidden. Put interactive content in aButton,IconButtonor link instead of adding click or keyboard handlers to the addon. Those controls keep their own focus and events. - Pressing a non-interactive part of the group focuses the input. Pressing an interactive addon targets that control and leaves focus alone, and portalled addon content does not refocus the input. Call
preventDefault()in the group'sonMouseDownto opt out. - The group supports the default input size. A new size belongs on
InputGroup, which owns the shared surface and addon layout, rather than on the input and addons separately.
Anatomy
InputGroup owns the border, background, focus ring and the non-interactive pointer surface. InputGroupInput owns the native input and its value. InputGroupAddon owns the layout of its supporting content. The direct input can also be another native input that owns its value and states, as in PasswordField.
Examples
Decorative icon
The search icon is decorative and renders visually first through the default inline-start alignment while the input stays first in the DOM. The search box filters the list it sits above and has no room for a visible label, so the input takes aria-label; the <search> element marks it as a search landmark.
- Product FAQ24 docs
- Refund policy12 docs
- API reference48 docs
- Release notes19 docs
Suffix
align="inline-end" places a fixed suffix after the value. Clicking the suffix focuses the input. For numeric values with units and steppers, use NumberField instead.
Saved as a Markdown file in the knowledge base.
Actions
Interactive addons are real controls: a text Button copies a read-only value, and an IconButton opens a Menu through its trigger's render. Neither moves focus to the input when pressed.
Disabled
Setting disabled on Field disables InputGroupInput, and the group dims the surface and its non-interactive addons together.
Contact a workspace owner to change the domain.
Validation
Inside a Form, the input's native constraints drive FieldError, and the whole group shows the invalid state. Errors appear when the form is submitted, then update as the value changes. Submit the form empty or with uppercase letters to see each message.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves focus to the input, then to each interactive addon in DOM order, whatever its visual alignment. |
| Shift+Tab | Moves focus back through the interactive addons and the input. |
API reference
InputGroup
A compound text-input container for composing an input with prefix, suffix, or action add-ons. Renders a <div> element.
Place the direct InputGroupInput before direct InputGroupAddon children in the DOM and use align for visual placement.
Accepts the props of the element it renders.
InputGroupAddon
| Prop | Type | Default | Details |
|---|---|---|---|
align | 'inline-end' | 'inline-start' | 'inline-start' | |
| Attribute | Description |
|---|---|
data-align | Values: The visual side of the input the addon sits on. |
InputGroupInput
A native input element that automatically works with Field. Renders an <input> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: InputState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: InputState) => React.CSSProperties | undefined) | No default | |
onValueChange | ((value: string, eventDetails: BaseInput.ChangeEventDetails) => void) | No default | |
defaultValue | string | number | readonly string[] | No default | |
value | string | number | readonly string[] | No default | |
| Attribute | Description |
|---|---|
data-disabled | Present when the input is disabled. |
data-valid | Present when the input is in a valid state (when wrapped in Field.Root). |
data-invalid | Present when the input is in an invalid state (when wrapped in Field.Root). |
data-touched | Present when the input has been touched (when wrapped in Field.Root). |
data-dirty | Present when the input's value has changed (when wrapped in Field.Root). |
data-filled | Present when the input is filled (when wrapped in Field.Root). |
data-focused | Present when the input is focused (when wrapped in Field.Root). |