Components
Astryx (Meta) ButtonGroup — joins related actions into a single connected control: clipboard actions and a primary split save button.
npx @21st-dev/cli add Astryxdesign/astryx-button-groupLoading preview...
// Copyright (c) Meta Platforms, Inc. and affiliates.
'use client';
import {ButtonGroup} from '@/components/ui/astryx-button-group';
import {Button} from '@astryxdesign/core/Button';
import {IconButton} from '@astryxdesign/core/IconButton';
import {Stack} from '@astryxdesign/core/Layout';
import {Icon} from '@astryxdesign/core/Icon';
import {
ClipboardDocumentIcon,
ScissorsIcon,
ClipboardIcon,
ChevronDownIcon,
} from '@heroicons/react/24/outline';
// Standalone setup (matches apps/example-vite): the Theme provider sets
// data-astryx-theme and injects the neutral theme tokens the @scope'd CSS needs.
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
export default function ButtonGroupShowcase() {
return (
<Theme theme={neutralTheme}>
<div data-astryx-theme="neutral">
<Stack direction="horizontal" gap={6} vAlign="center">
<ButtonGroup label="Clipboard actions">
<Button
label="Copy"
icon={<Icon icon={ClipboardDocumentIcon} />}
/>
<Button label="Cut" icon={<Icon icon={ScissorsIcon} />} />
<Button label="Paste" icon={<Icon icon={ClipboardIcon} />} />
</ButtonGroup>
<ButtonGroup label="Save options">
<Button label="Save" variant="primary" />
<IconButton
label="Save options"
variant="primary"
icon={<Icon icon={ChevronDownIcon} />}
/>
</ButtonGroup>
</Stack>
</div>
</Theme>
);
}