cnippet/ui
  1. ui
  2. layout
  3. group

layout

Group

A component for visually grouping a series of controls. Built with Base UI and Tailwind CSS. Copy-paste ready.

Installation

Usage

Anatomy

Good to know

  • Group joins neighboring controls into one piece: shared borders and only the outer corners rounded. It works with Button, Input, Select, NumberField, menus and similar controls.
  • ButtonGroup, ButtonGroupSeparator and ButtonGroupText are aliases of Group, GroupSeparator and GroupText.
  • Put a GroupSeparator between items that would otherwise share a border, such as two filled buttons.
  • orientation="vertical" stacks the items and rounds the top and bottom corners instead.
  • Nest Groups to create separate clusters with a gap between them.
  • Add an aria-label so screen readers can name the group.

API Reference

Group

Root container that collapses borders between adjacent children into a single shared border. Also exported as ButtonGroup.

GroupText

Static text or label element inside the group. Also exported as ButtonGroupText.

GroupSeparator

Visual divider between group items. Also exported as ButtonGroupSeparator.

Examples

With Input

Combines a Group with an Input for a compound field where the input and an action button share a single visual container.

Small Size

Renders a Group at sm size so all enclosed controls shrink proportionally for compact toolbar or inline contexts.

With Disabled Button

Shows how a disabled button integrates visually within the grouped control, preventing interaction without breaking the layout.

With Default Buttons

A baseline group of default-style buttons demonstrating the shared border collapse and corner rounding behavior.

With Prefix Label

Prepends a static text label to the group as the first item, anchoring a unit or field prefix such as "https://".

With Suffix Label

Appends a static text suffix or unit label at the trailing end of the group, such as ".com" or "kg".

Vertical

Stacks group items vertically instead of horizontally for menu-like or stacked control layouts.

Nested Groups

Demonstrates grouping within a group, allowing complex compound controls with multiple separators and sub-sections.

With Popup

Attaches a Popover or dropdown to a button inside the group, enabling inline contextual actions.

With Input Group

Nests an InputGroup inside a Group for more complex compound field arrangements with multiple inline adornments.

With Menu

Embeds a Menu trigger inside the group to create a split-button or action group with a dropdown for secondary options.

With Select

Attaches a Select dropdown to the group so users can choose between options alongside an adjacent action button.

Text Formatting Toolbar

Four icon-toggle buttons (bold, italic, underline, strikethrough) that track active state with aria-pressed — useful for rich-text editors.

Thumbs Up / Down Vote

Two reaction buttons with live counts using Badge. Clicking toggles the vote and updates the count in real time.

Media Player Controls

Previous, play/pause (stateful), and next icon buttons in a grouped row for compact audio or video playback interfaces.

Price Range Input

Dual numeric inputs with a currency prefix ($), a text separator (–), and an apply button — all connected in a single Group.

Search with Category Filter

A Select for category, a text search input, and a search icon button composed into one compound search bar.