Skip to content

ButtonGroup ​

Icon buttons that belong together, set 1 pixel apart so a toolbar shows them as one cluster.

tsx
import { ButtonGroup } from '@adecore/ui';
tsx
import { ButtonGroup, IconButton } from '@adecore/ui';
import { AlignCenter, AlignLeft, AlignRight, Redo, Undo } from 'lucide-react';

export default function ButtonGroupDemo() {
    return (
        <div className="flex items-center gap-4">
            <ButtonGroup>
                <IconButton icon={Undo} label="Undo" />
                <IconButton icon={Redo} label="Redo" />
            </ButtonGroup>
            <ButtonGroup role="group" aria-label="Alignment">
                <IconButton icon={AlignLeft} label="Align left" active />
                <IconButton icon={AlignCenter} label="Align center" />
                <IconButton icon={AlignRight} label="Align right" />
            </ButtonGroup>
        </div>
    );
}

A group draws no border or background. Give it role="group" and an aria-label when the buttons share a purpose. Stepper and ZoomControls are button groups on a sunken track.

Props ​

ButtonGroup renders a <div> and takes its props, plus render. ButtonGroupProps is an exported type.

Licenses and third-party notices are listed in each package.