Button Group

A container that groups related buttons together with consistent styling.

Orientation

Set the orientation prop to change the button group layout.

Size

Control the size of buttons using the size prop on individual buttons.

Nested

Nest components to create button groups with spacing.

Separator

The ButtonGroupSeparator component visually divides buttons within a group. Buttons with variant outline do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.

Split

Create a split button group by adding two buttons separated by a ButtonGroupSeparator.

Input

Wrap an Input component with buttons.

Input Group

Wrap an InputGroup component to create complex input layouts.

Dropdown Menu

Create a split button group with a DropdownMenu component.

Select

Pair with a Select component.

Popover

Use with a Popover component.

Agent Tasks

Start a new task with Copilot

Describe your task in natural language. Copilot will work in the background and open a pull request for your review.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::*;

#[component]
pub fn ButtonGroupAnatomy() -> impl IntoView {
    view! {
        <ButtonGroup>
            <Button />
            <ButtonGroupSeparator />
            <ButtonGroupText />
        </ButtonGroup>
    }
}

API Reference

ButtonGroup

Contains the Buttons that make up the ButtonGroup.

Custom Attributes
NameTypeDefaultDescription
verticalboolfalse

Sets the display direction of the ButtonGroup.

Implements global attributes.

ButtonGroupSeparator

Visually separates elements in the ButtonGroup.

Implements global attributes.

ButtonGroupText

Creates a styled text element for use in the ButtonGroup.

Implements global attributes.