Skip to content
Mosaic
On this page

InputGroup

Draws one field chrome around an Input and addons on either side, such as an icon, a prefix or a button. A click on a bare part of the group focuses the input.

Use for

  • an input with a leading icon or prefix
  • an input with a trailing button, such as show password or clear

Practices

GuidancePractice
DoUse InputGroup.Input, so the input takes the group size and drops its own chrome.
DoPut a Button in an addon without size or variant props. The addon sizes it as a square neutral ghost button to fit the group.
Don’tRender InputGroup.Start or InputGroup.End outside InputGroup.Root. They throw.

API reference

InputGroup.Root

A div that draws the chrome and carries data-size, data-disabled and data-invalid.

Slot: cl-input-group

PropTypeDescription
sizeInputGroupSizesm, md or lg. The input and addon buttons follow it.Default: 'md'
disabledbooleanDisables the input and addon buttons.Default: the enclosing `Field`'s, else `false`
invalidbooleanMarks the input aria-invalid.Default: the enclosing `Field`'s, else `false`

InputGroup.Input

The Input, as a ghost input sized by the group.

Slot: cl-input

InputGroup.Start

A span before the input. Sets the defaults for any Button inside it.

Slot: cl-input-group-start

InputGroup.End

A span after the input. Sets the defaults for any Button inside it.

Slot: cl-input-group-end

Examples

A search input

TSX
<InputGroup.Root>
  <InputGroup.Start>
    <Icon glyph={MagnifyingGlass} />
  </InputGroup.Start>
  <InputGroup.Input type='search' aria-label='Search' />
</InputGroup.Root>