Input group
krper night
npx shadcn add @klarhimmel/input-group @klarhimmel/inputCopy for AIExamples
Currency
Url
States
DetailsAbout, usage, props and more
One field made of parts: a prefix or suffix, the input and a button, sharing one border and one focus ring.
When to use
Use for
A value with its unit, scheme or action beside it: kr, https://, a copy button, a search icon.
Not for
A plain field. Use Input. A choice from a list. Use Select.
Pairs with
Field, Kbd, Button.
Preview
krper night
Including VAT.
Import
Import
- Files
- input-group.tsx, input.tsx, in components/klarhimmel/ui/. With it: button, editing, theme, utils.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
InputGroup.invalid | boolean | - | |
InputGroup.disabled | boolean | - | Draws the red border or the disabled look on the whole group. Put aria-invalid or disabled on the input too. |
InputGroup.className | string | - | Extra classes, merged after the component's own. |
InputGroup.children | ReactNode | required | |
InputGroupAddon.align | 'start' | 'end' | 'start' | |
InputGroupAddon.className | string | - | Extra classes, merged after the component's own. |
InputGroupAddon.children | ReactNode | required | |
native attributes | HTMLAttributes | - | Every native attribute of the element passes through, className included. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves through the input and the buttons in the group |
Enter / Space | Presses a focused button |
The group draws the frame and the focus ring; the input is named by its Field label. Text addons are read in order, so write them as part of the question.
Accessibility