Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Button Group

Groups related buttons together edge-to-edge, horizontal or vertical.

https://

Installation

npx logic2b@next add button-group

Usage

import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "@/components/ui/button-group"

<ButtonGroup>
  <Button variant="outline">Copy</Button>
  <Button variant="outline">Paste</Button>
</ButtonGroup>

<ButtonGroup>
  <ButtonGroupText>https://</ButtonGroupText>
  <ButtonGroupSeparator />
  <Button variant="outline">example.com</Button>
</ButtonGroup>

Usage notes

All three parts also forward the native props of the element they render (ButtonGroup and ButtonGroupText render a <div>; ButtonGroupSeparator renders a Separator).

Examples

Vertical

With an input

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<ButtonGroup
  orientation="horizontal"
  aria-label="Editor actions"
>
  <button
    type="button"
    className="rounded-md border px-3 py-2 text-sm font-medium"
  >Undo</button>
  <ButtonGroupText>3 changes</ButtonGroupText>
  <button
    type="button"
    className="rounded-md border px-3 py-2 text-sm font-medium"
  >Publish</button>
</ButtonGroup>

API reference

Generated from the public TypeScript exports in src/ui/button-group.tsx.

View JSON

ButtonGroup

Component
Props: React.ComponentProps<"div"> & { orientation?: "horizontal" | "vertical" }
PropTypeRequiredDefaultDescription
orientation"horizontal" | "vertical"No"horizontal"—

ButtonGroupText

Component
Props: React.ComponentProps<"div"> & { asChild?: boolean }
PropTypeRequiredDefaultDescription
asChildbooleanNofalse—

ButtonGroupSeparator

Component
Props: React.ComponentProps<typeof Separator>
PropTypeRequiredDefaultDescription
orientation"horizontal" | "vertical"No"vertical"Either `vertical` or `horizontal`. Defaults to `horizontal`.

Accessibility contract

Machine-readable behavior and consumer responsibilities for button-group.

View JSON
Support
Composition contract
Pattern
group of actions
HTML div

Built-in semantics

  • Groups native buttons visually without replacing their button semantics.

Consumer responsibilities

  • Add role=group and an accessible name when the buttons form one conceptual control.