Attach prefixes, suffixes, icons and buttons to a text input so they read as one field, such as an https:// prefix, a .com suffix, a currency, a copy button or a password toggle. Composes with React Aria's TextField, NumberField and SearchField, and the focus ring wraps the whole group.
InputGroup is the same chrome as every other field (FieldGroup from field.tsx) with the padding moved onto its parts. Put it inside a React Aria field and InputGroupInput picks up the value, label, description and validation from the field.
TextField already has prefix and suffix
For a single icon or short text inside the field, Text Field's
prefix and suffix props are enough. Reach for Input Group when you need
flush segments, buttons, several addons, or a NumberField.
<TextField> {/* or NumberField, SearchField */} <Label /> <InputGroup> {/* role="group", draws the border and focus ring */} <InputGroupAddon /> {/* inline text or icon, or a flush segment */} <InputGroupInput /> {/* the <input> */} <InputGroupButton /> {/* ghost button inside, or a flush segment */} </InputGroup> <Description /> <FieldError /></TextField>
Part
Renders
Notes
InputGroup
React Aria Group (role="group")
Field chrome with variant (outline, filled, underlined) and size. Shows the focus ring when anything inside has focus, and the invalid style when the field is invalid.
InputGroupInput
React Aria Input
Bare input that fills the space. Pads itself only at the group's edges.
InputGroupAddon
<span>
inline: muted text or icon inside the field. segment: a flush, tinted box divided by a border.
InputGroupButton
React Aria Button
ghost (default): a small icon button inside the field. segment: a flush, full-height button divided by a border.
variant="segment" turns the button into a flush, full-height part of the field, for actions like Subscribe or Apply. type="submit" submits the surrounding form.
The input gets its name from the surrounding field's Label (or aria-label on the field), and its description and error message through React Aria.
InputGroup is a React Aria Group with role="group". The focus ring is drawn on the group when the input or a button inside it has focus, so it always wraps the full field.
Addons are plain text. A screen reader user won't hear "https://" when focusing the input; if the prefix matters, mention it in the label or description ("Website, without https://").
Buttons are separate tab stops after (or before) the input. Icon-only buttons need an aria-label, and buttons that change state (copy, reveal) should update it ("Copied", "Hide password").
Parts read --ig-px for their edge padding: 8, 10 and 12px for sm, md and lg, and 0 for underlined groups. Override it on the group: className="[--ig-px:--spacing(4)]".