Button Group

React Button Group components are used to group related actions together. They help present multiple buttons as a single unit, making it easier for users to understand available options.

This Button Group component is built with React and styled using Tailwind CSS, providing consistent spacing, alignment, and visual grouping.

Installation

Install the component using the Tailgrids CLI.

npx @tailgrids/cli@latest add button-group

Usage

Import the component and wrap related Buttons inside it. ButtonGroup has no variant or size of its own: each button carries its own variant, appearance and size.

import { Button } from "@/components/tailgrids/button";
import { ButtonGroup } from "@/components/tailgrids/button-group";

export const ButtonGroupExample = () => (
  <ButtonGroup>
    <Button appearance="outline">Day</Button>
    <Button appearance="outline">Week</Button>
    <Button appearance="outline">Month</Button>
  </ButtonGroup>
);

Examples

Variants

Give each Button its own variant / appearance, and add ButtonGroupSeparator or ButtonGroupText parts between or beside them.

Link
$

Sizes

Set size on each Button to match surrounding UI elements.

Custom

Create a custom styled example using className to override styles.

API Reference

ButtonGroup

Extends div element props. Renders role="group".

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Direction the grouped controls are laid out
classNamestring-Additional CSS classes
childrenReact.ReactNode-Buttons, ButtonGroupSeparator, ButtonGroupText

ButtonGroupSeparator

A Separator between grouped controls. Its orientation defaults to 'vertical'.

ButtonGroupText

A static, styled label (for example a currency symbol) rendered next to the grouped controls.

On this page

Tailgrids Pro

Access 600+ blocks, components and templates - built for speed, consistency, and scale.

Get Tailgrids Pro