Skip to content

ButtonGroup

import { ButtonGroup } from 'yarcl';

Buttons inside a group inherit size, color, variant and radius unless they set their own. Attached groups share borders, with a divider between solid buttons.

<ButtonGroup aria-label="Pagination" variant="outline" color="neutral">
<Button>Previous</Button>
<Button>1</Button>
<Button>2</Button>
<Button>Next</Button>
</ButtonGroup>
<ButtonGroup aria-label="Share" attached={false} variant="soft" size="sm">
<Button>Copy link</Button>
<Button>Email</Button>
</ButtonGroup>
  • Renders role="group". Give it an aria-label that describes the set of actions.
PropTypeDefaultDescription
attachedbooleantrueJoins the buttons into one control with shared borders.
colorColorconfigconfig.defaults.colorSemantic color, from the colors config.
orientation'horizontal' | 'vertical''horizontal'Direction of the buttons.
radius'size' | Radiusconfigconfig.defaults.radiusBorder radius, from the radii config, or 'size' for the radius named like the control's size.
sizeSizeconfigconfig.defaults.sizeControl size, from the sizes config.
variantVariantconfigconfig.defaults.variantStyle recipe, from the variants config.