Components · Inputs
InputGroup
An input with a fixed prefix, suffix, icon or button inside the same bordered box, such as a domain, a unit or a search icon.
import { InputGroup } from "@botiverse/raft-ui";An input group puts fixed text, an icon or a button inside an input's box: a domain before a server's address, a unit after a budget, a search icon before a query. The box, its border and its states belong to the group, so the input and its addons read as one control.
When to use
Anatomy
InputGroup: the bordered box. Required.InputGroupAddon: an icon or a button at the start or end (align).InputGroupAddon.Text: fixed text at the start or end, in Space Mono andforeground-hint.InputGroupInput: the input itself, without a border of its own. Required.
Variants
Sizes
- In a toolbar or a filter row, give the field the row's button height with
size="md". A 44px field beside 32px filter triggers and a view switch reads taller and heavier than the rest of the row on a touch screen (xxchan, 2026-11-06, #proj-workspace:68999338); with a mouse both are 34px, so nothing changes there (Spacing). - By touch an
mdfield keeps a 44px tap area: its input takes taps 6px past the box above and below. The tap area covers the input, not a leading icon or text addon. Keep at least 6px between the field and the controls above and below it, as with a Button atmd. - An
mdfield's input text stays 16px by touch, so iOS doesn't zoom into the field on focus. - A Button in an
mdfield's end addon is the field's height less 6px above and below: 20px by touch, 22px with a mouse.
States
- Put
data-invalidanddisabledonInputGroupInput. The group draws them: adanger-strongborder when invalid, the shared disabled look when disabled (States). - The focus ring goes around the whole group (States).
Behavior
- In a search field, put an 18px search icon at the start, and a clear button at the end once there is text.
- A Button in an addon is a control embedded in the field: 22px on a desktop and 32px on a phone, with
radius-chipand a 16px icon. In an end addon, when it is the last child it sits 6px from the field's end, as far as from its top and bottom; put a hint such as Esc before it, not after. In a start addon, such as a browser's site settings before the address, it is the mirror: as the first child it sits 6px from the field's start (Shape). - A text addon takes at most half the group and truncates past that, with its whole text as its
title, so there is always room to type (Forms).
Accessibility
InputGroupInput wraps Base UI Input; the group itself is a plain <div>.
- Name the input with a
FieldLabel(Field), or witharia-labelon a search field that has no visible label (Search). - Give a button addon its own
aria-label(Clear search). - Text addons are not read as part of the value. When the prefix matters for understanding the value, say it in the label or the help text.
API
InputGroup
Also takes the attributes of its element.
InputGroupAddon
Also takes the attributes of its element.
InputGroupInput
Also takes the attributes of its element.
Related
Changes
- 0.10.0 · Breaking ChangesField frames (
Input,Textarea,InputGroup,Select,Combobox,ComboboxSelect,Composer, optionCard,SearchTrigger) are drawn at 1px inline-fieldinstead of 1.5px, on the phone too. - 0.5.35 · Changed
InputGroupaddon and text colours are driven by variables on the group root. A caller-provided text-colour class on those parts replaces their colour in every state, focus and disabled included.