Group
Join related controls into one visual group.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/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/button @siteplane/form @siteplane/input @siteplane/menuUsage
import { Button } from "@/siteplane/components/button";
import { Group, GroupSeparator } from "@/siteplane/components/group";
<Group aria-label="Message actions">
<Button variant="outline">Archive</Button>
<GroupSeparator />
<Button variant="outline">Report</Button>
</Group>;Composition
Group
├── GroupText
├── Input or Button
├── GroupSeparator
└── ButtonWith text
Use GroupText for a fixed prefix or suffix, such as a protocol or unit. Next to an input, the group draws one frame around the text and the input, with the same focus, invalid and disabled states as an input. GroupText doesn't label the input, so give the input its own accessible name.
With input
Join an input with the button that acts on its value. Put the group in a Form and give the button type="submit": Enter in the input then submits the form like a click on the button, and onSubmit receives both. A keyboard submit does not press the button, so the confirmation belongs to the result, shown here as a status line. While a request runs, set loading on the button.
Orientation
Set orientation="vertical" to stack controls; a GroupSeparator between them turns horizontal with the group.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Group. | horizontal | vertical | horizontal styling | Joined edges; data-orientation omitted unless set. |
Group. | inset | unset | Separates direct buttons of a horizontal group with a short inset divider instead of a full-height line. Use GroupSeparator between other controls. |
Group. | ReactNode | required | Controls or nested groups. |
Group. | ARIA role | group | Grouping semantics. |
Group | ReactElement | render function | div | Composed element. |
Group | horizontal | vertical | across the group | Divider direction: vertical in a horizontal group, horizontal in a vertical one. |
Group accepts native div props and refs; GroupText accepts useRender div props; GroupSeparator accepts Separator props. All accept string className. groupVariants({orientation, separator, className}) returns styling, defaulting orientation to horizontal. No shared state, size, disabled or roving focus API is added.
Usage notes
Label every group with aria-label or aria-labelledby. Use Toolbar for roving focus and ToggleGroup for shared pressed selection. Controls keep their own behavior and focus stops.
Give an icon-only segment shape="square", including a trigger supplied through render, so it takes the same height as the buttons beside it. A fixed icon size such as size="icon-md" keeps its own height: next to buttons that follow the provider's control size, its hover surface covers only part of the segment and its icon sits off center.