Input Group
Attach text, icons or actions to an input surface.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/input-groupComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/action-icons @siteplane/button @siteplane/inputField is installed with Input.
Usage
import {
InputGroup,
InputGroupInput,
} from "@/siteplane/components/input-group";
<InputGroup>
<InputGroupInput aria-label="Search" />
</InputGroup>;Composition
InputGroup
├── InputGroupAddon
│ └── InputGroupText or Button
├── InputGroupInput / InputGroupTextarea / InputGroupSegment
└── InputGroupAddonWith text
Put InputGroupText in an addon for a fixed prefix or suffix, such as a protocol or currency. Addon text is not part of the submitted value.
With a button
Place a Button in an inline-end addon for an action on the value. divider separates it from the input and padding="compact" fits a text button. An icon-only action (show or hide, copy, clear, open a picker) uses profile="field-action" with shape="square": a bare icon without a box or hover background that darkens on hover and press, with the focus ring tight around the icon. For a copy action, use Copy Button with profile="field-action".
Password visibility
Toggle the input type with an icon Button on the field-action profile. Keep its label constant and expose the state with aria-pressed.
Block addons
Block-aligned addons place a header or footer inside a textarea group. InputGroupTextarea grows with its content like Textarea, so it shows no resize grip where the browser supports field-sizing: content. For an action that sits over the textarea, such as a square Button in its top-end corner, set insetEnd on InputGroup: the text then ends 8 px before a Button of the control size.
Surfaces
The group owns the shared surface. Inner input/textarea wrappers are unstyled.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Input | default | elevated | inset | soft | default | Shared surface. |
Input | sm | base | inferred from lg/xl child; otherwise CSS | Text size. |
Input | boolean | false | Keeps the end of the input or textarea clear for an action placed over it, such as a square Button 8 px inside the corner. |
Input | MouseEventHandler | unset | Called before focus forwarding; preventDefault cancels forwarding. |
Input | inline-start | inline-end | block-start | block-end | inline-start | Position in the group. |
Input | boolean | false | Draws a border between the addon and the control. |
Input | default | compact | none | default | compact reduces the addon's outer inline padding; none removes its padding. |
Input | 2-digit | 4-digit | fill | 2-digit | Segment width. |
Input | boolean | false | Inset start edge. |
Input | FocusEventHandler | unset | Called after the native input text is selected. |
InputGroup accepts native div props, default role group. Clicking
non-interactive space forwards focus to an enabled input, textarea or
spinbutton. InputGroupAddon accepts div props; InputGroupText accepts span
props. InputGroupInput and InputGroupSegment accept InputProps except
unstyled, and InputGroupTextarea accepts TextareaProps except unstyled: the
group draws the field surface, so the inner control is always unstyled. Inner
size, state, events and form props remain those of Input/Textarea. All parts
accept string className. There is no InputGroupButton export; compose Button
directly.
Usage notes
Addon text is not automatically an input label or description. Use Label/Field and aria-describedby as appropriate. The group does not manage values, disable all children, validate data or submit a form.