Skip to main content
InputGroup gives an Input a shared border and optional leading or trailing content. Set size on the group to size the container and provide a default for its input. Explicit child size takes precedence over that default; the group still controls the shared layout height.

Usage

startElement and endElement accept React nodes. Prefixes and suffixes are visual content; the input’s submitted value contains only what the user enters.

Visual choices

Compare prefix, suffix, and combined adornments at both input sizes. The group shares its size with the input.

Anatomy

Place the input inside InputGroup and keep field labels and messages outside the shared border.
startElement and endElement are React node props, not separate components. InputGroup does not supply a label or manage validation. Give the input an accessible name, either through Field.Label or its own labeling attributes.

Trailing action

Put labels, validation, and value handling on the field or input. Give adornment buttons their own accessible names and use type="button" when they should not submit the form. The group supports sm and md sizes and defaults to md.

Customize the layout

Native props, className, style, render, and ref target the layout div. A custom render element receives the layout props and children. Keep the supplied ref on that layout element. Put value, defaultValue, onValueChange, name, required, readOnly, disabled, and the native control ref on Input. The group does not manage input state or replace Field label association.

Props

The reference is generated from the public component types. Native attributes, including accessible names and event handlers, are also accepted on parts that render elements.
ReactNode
Content rendered after the input, such as a suffix or a button.
Ref<HTMLDivElement>
Ref to the layout element, a div by default.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>
Customizes the layout element. Forward its props, children and ref. Native control props belong on the child input.
"md" | "sm"
default:"md"
Visual size of the layout and default size for inputs that omit size. Defaults to md.
ReactNode
Content rendered before the input, such as a prefix or an icon.