Forms

Input Group

Compose an Input with adornments, addon icons, trailing buttons, prefix labels.

Preview
01 Installation

Install

Pull Input Group from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { InputGroup } from "@brika/clay";
tsxGranular1 line
import { InputGroup } from "@brika/clay/components/input-group";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxInput Group.tsx23 lines
import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,
  InputGroupText,
} from '@brika/clay/components/input-group';

/** Currency field with dollar-sign prefix and currency code suffix. */
export default function InputGroupDefaultDemo() {
  return (
    <div className="w-full max-w-xs">
      <InputGroup>
        <InputGroupAddon>
          <InputGroupText>$</InputGroupText>
        </InputGroupAddon>
        <InputGroupInput placeholder="0.00" type="number" min={0} step={0.01} />
        <InputGroupAddon align="inline-end">
          <InputGroupText>USD</InputGroupText>
        </InputGroupAddon>
      </InputGroup>
    </div>
  );
}
03 Examples

Input Group, every way

Code Editor

Multiline editor with a file-header toolbar and a footer Run action.

Email

Username field with a fixed company domain suffix.

Kbd

Search input with a trailing ⌘K keyboard shortcut hint.

Search field with a leading icon and a trailing clear button.

Textarea

Multiline field with a block-end helper showing remaining characters.

Url

URL field with scheme prefix and TLD suffix.

04 Accessibility

Accessibility

  • Addons are presentational, always pair the group with a <Label> that describes the full field.
  • Icon-only addon buttons require an aria-label.
  • The visible prefix (e.g. "https://") is part of the label context; announce it via aria-label on the input if needed.
05 Tokens 9 theme-overridable

Theme tokens

Every CSS variable Input Group reads, with its default and the dotted path you'd write in a ThemeConfig JSON to override it. Set any of these in your theme to retune Input Group without touching component code.

Input Group tokens

9 tokens
ColorFill, border, and text colors.8
  • --input-group-containercolorvar(--input-container)
    components.inputGroup.container

    Background color of the InputGroup wrapper. Inherits the standalone Input container so themes that retune `--input-container` retune the group automatically.

  • --input-group-labelcolorvar(--input-label)
    components.inputGroup.label

    Default foreground color of text rendered inside the InputGroup wrapper. Mirrors `--input-label`.

  • --input-group-bordercolorvar(--input-border)
    components.inputGroup.border

    Resting border color of the InputGroup wrapper. Mirrors `--input-border`.

  • --input-group-focus-bordercolorvar(--ring)
    components.inputGroup.focusBorder

    Border color drawn on the wrapper when the inner control receives keyboard focus (`focus-visible`). Pairs with `focus-ring` to render the focus halo.

  • --input-group-focus-ringcolorvar(--ring)
    components.inputGroup.focusRing

    Color of the 3px focus halo painted around the wrapper when the inner control is focus-visible. Rendered at 50% opacity to soften the outer glow.

  • --input-group-invalid-ringcolorvar(--destructive)
    components.inputGroup.invalidRing

    Single color driving the invalid state: the wrapper border uses it directly while the surrounding ring uses it at 20% (light) / 40% (dark) opacity.

  • --input-group-addon-labelcolorvar(--muted-foreground)
    components.inputGroup.addonLabel

    Foreground color of inline addon content (icons, text, kbd) docked at the start or end of the group.

  • --input-group-text-labelcolorvar(--muted-foreground)
    components.inputGroup.textLabel

    Foreground color of `InputGroupText` spans rendered inside the group (helper labels, separators).

ElevationDrop shadow and depth.1
  • --input-group-backdrop-blurblur0px
    components.inputGroup.backdropBlur

    Backdrop blur applied to the input-group surface. Set non-zero for a frosted-glass treatment.

Override in a theme

Authoring a theme is plain JSON. Drop overrides under components.inputGroup, the names are camelCase versions of the variable suffix.

jsonmy-theme.json12 lines
{
  "id": "my-theme",
  "name": "My Theme",
  "description": "...",
  "accentSwatches": ["#000"],

  "components": {
    "inputGroup": {
      "container": "var(--input-container)"
    }
  }
}

Then apply with applyTheme(myTheme) (see the theming guide), scope it to a subtree with themeToCssVars(myTheme, mode), or consume any token directly in your own JSX with the matching Tailwind utility (e.g. bg-input-group-…) — see the chips on each token row.

06 API reference

API reference

Props specific to Input Group. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.

<InputGroup />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<InputGroupAddon />

1 prop
  • aligndefault 'inline-start'
    'inline-start' | 'inline-end' | 'block-start' | 'block-end'
    Which edge the addon docks against.

<InputGroupButton />

2 props
  • sizedefault 'xs'
    'xs' | 'sm' | 'icon-xs' | 'icon-sm'
    Size preset for the addon button.
  • variantdefault 'ghost'
    React.ComponentProps<typeof Button>['variant']
    Visual preset for the addon button.

<InputGroupControlIdContext />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<InputGroupInput />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<InputGroupText />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<InputGroupTextarea />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.