Skip to content

InputGroup

⋯

InputGroup composes Figma Basic Input’s General, Password, and Phone presentations and both Search Input treatments. It wraps a native 36px input with an 8px radius and places InputGroup.Addon content beside the editable value. Use Input for a control without addons.

import { InputGroup } from "@nesra/ui/input-group";
export function AddressField() {
return (
<InputGroup label="Workspace address">
<InputGroup.Addon aria-hidden="true">@</InputGroup.Addon>
<InputGroup.Input name="workspace" placeholder="my-team" />
</InputGroup>
);
}

InputGroup is also exported from @nesra/ui.

InputGroup
├── InputGroup.Addon (optional prefix)
├── InputGroup.Input
└── InputGroup.Addon (optional suffix)
└── InputGroup.Button (optional action)

InputGroup.Addon places consumer supplied icons or text beside InputGroup.Input. Password uses native masking through type="password". The Phone prefix uses the 🇮🇩 emoji and +62. It does not select a country or alter the submitted value. The chevron and info icons are decorative. Consumers own any reveal action, country selection, and phone formatting. Emoji appearance depends on the platform. The icon example imports lucide-react. Add it as a direct dependency if you copy the example into your app. See Icons.

This is a hint text to help user

This is a hint text to help user

This is a hint text to help user

Focus an enabled input to inspect the group focus ring. A value creates the Filled presentation. error displays the Error presentation. disabled prevents editing and form submission.

The whole group takes the focus ring when its input has focus, and the destructive border and ring when error is set or the input is invalid. Addon text uses text-support and addon icons use icon-muted. Both switch to the disabled roles when the group is disabled. Colors follow the field state colors in Light and Dark.

Use your work address

Use your work address

Unavailable

The prefix and suffix are visual context and are not included in the submitted value.

Enter only your workspace name

Figma’s Has Shortcut and Has Button search treatments use InputGroup.Input type="search" with different trailing content. The shortcut is a visual hint. The consuming page registers any keyboard shortcut. Place InputGroup.Button type="submit" in a trailing addon inside a form. The group’s disabled state also disables the button.

⌘ K
⌘ K
⌘ K

4 matching components

  • Button
  • Input
  • InputGroup
  • Text Area
Submit a search to see its value.
  • label associates a visible label with InputGroup.Input. Without it, name the input with aria-label or aria-labelledby. A placeholder and decorative addon are not labels.
  • description becomes the input’s accessible description. error replaces it with an associated alert. The consuming form owns validation timing and message content.
  • A visual prefix such as +62 is not included in the submitted value. Include its meaning in the accessible name or description when needed. Mark decorative icons with aria-hidden="true".
  • Set required on InputGroup.Input for native validation. The group prop shows the marker. disabled on the group disables the input. The input’s ref points to the native element.
  • For search, set type="search" on InputGroup.Input and give it an accessible name. A search icon or placeholder does not name the field. Keep a submit button outside aria-hidden content.

The root renders the group and provides its disabled state to the child input. It accepts native div props and forwards its ref to the group element.

Prop Type Default Effect
children ReactNode — Renders the input and addons.
label ReactNode — Adds a visible Base UI Field label.
description ReactNode — Adds help text below the group.
error FieldError — Displays an associated validation message.
required boolean false Shows the required marker only.
disabled boolean false Disables the child input.

See the FieldError type for validation matching.

The editable part renders a Base UI input and accepts its native input attributes, including type, name, value, defaultValue, onChange, and onValueChange. Set required on this part for native validation. Its ref points to the input element. The root’s disabled state also disables this part.

The addon renders a span for icons or text and accepts native span props. Its ref points to the span element. DOM order determines whether it appears before or after the input. Addons must be inside InputGroup.

Prop Type Default Effect
align "start" | "end" "start" Pushes the addon toward the trailing edge when end.

The compact action accepts Button props except variant and size. It renders inside an InputGroup.Addon and inherits the group’s disabled state. Set type="submit" when the action submits a form. Its ref points to the button element.

The visual values come from the color roles, typography roles, layout scale, and shape and elevation tokens.