Rime

InputGroup

A text field with addons joined to it: a fixed text segment, an icon, or a button such as Copy.

InputGroup wears the TextInput box and its --input-* tokens, with addons set into either end. A string addon ("https://", "$", "kg") is drawn as a sunken text segment divided by a hairline; an element addon (an icon or an IconButton) sits inline.

Focus, invalid, read-only and disabled all draw on the whole group, addons included. The <input> takes every native attribute, and reads its id, required and error state from a surrounding Field.

Installation

npx shadcn@latest add KezLahd/rime/input-group

Also installs: base, field, text-input.

Usage

import { InputGroup } from "@/components/ui";

<Field label="Website">
  <InputGroup start="https://" placeholder="example.com" />
</Field>

Examples

Text, icon and button addons

In a Field

Letters, numbers and dashes.

Enter a weight under 30 kg.

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

InputGroup

InputGroup props
PropTypeDefaultDescription
startReactNodeBefore the input. A string ("https://", "$") is set off as a sunken text segment with a hairline; an element (an icon, an IconButton) sits inline.
endReactNodeAfter the input, the same way: a unit ("kg", ".com") or a button.
size"sm" | "md""md"
invalidbooleanOverrides the Field's invalid state.
monoboolean
boxClassNamestringClass for the outer box rather than the <input>.

Also accepts the native attributes of AriaAttributes, DOMAttributes, HTMLAttributes, InputHTMLAttributes.

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

InputGroup per-component tokens
TokenDefaultLive value
--field-focus-borderrgba(var(--rgb-brand), 0.7) / var(--focus-color)…
--field-focus-ringvar(--focus-halo)…
--field-focus-ring-invalid0 0 0 4px rgba(var(--rgb-danger), 0.14)…
--field-hover-borderrgba(var(--rgb-brand-deep), 0.3)…
--input-addon-bgvar(--recess-fill)…
--input-bgvar(--surface-solid)…
--input-bordervar(--line-input)…
--input-border-widthvar(--border-w-field)…
--input-font-sizevar(--text-input)…
--input-height-mdvar(--field-h-md)…
--input-height-smvar(--field-h-sm)…
--input-pad-xcalc(14px * var(--density))…
--input-radiusvar(--r-md) / var(--r-sm)…
--input-shadowvar(--shadow-input)…

System tokens it reads

InputGroup system tokens
TokenDefaultLive value
--border-wtokens.css…
--border-w-fieldtokens.css…
--danger-basetokens.css…
--danger-field-filltokens.css…
--danger-linetokens.css…
--densitytokens.css…
--durtokens.css…
--easetokens.css…
--field-h-mdtokens.css…
--field-h-smtokens.css…
--focus-colortokens.css…
--focus-halotokens.css…
--font-bodytokens.css…
--font-monotokens.css…
--ink-bodytokens.css…
--ink-brandtokens.css…
--ink-disabledtokens.css…
--ink-mutedtokens.css…
--ink-placeholdertokens.css…
--ink-secondarytokens.css…
--linetokens.css…
--line-inputtokens.css…
--r-mdtokens.css…
--r-smtokens.css…
--r-xstokens.css…
--recess-filltokens.css…
--rgb-brandtokens.css…
--rgb-brand-deeptokens.css…
--rgb-dangertokens.css…
--shadow-inputtokens.css…
--surface-solidtokens.css…
--surface-sunkentokens.css…
--text-bodytokens.css…
--text-inputtokens.css…
--text-smalltokens.css…
--wash-activetokens.css…
--wash-subtletokens.css…

Accessibility

  • Text addons are visual only (aria-hidden). If the unit matters to understanding, say it in the label or hint as well ("Weight in kg").
  • Button addons are real buttons with their own accessible names, after the input in tab order.
  • Wrap it in <Field label=…> so the label, hint and error are wired through context.

Do and don't

Do

  • Use a text addon for a fixed part the user should not type.
  • Use PrefixedInput when the whole value has a fixed format.

Don't

  • Don't put more than one button in an addon.
  • Don't style the <input> directly; theme the box with --input-* tokens.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open input-group.md

Related: text-input, prefixed-input, field