Skip to content

Button

Terminal window
npx @bambiui/cli init
npx @bambiui/cli add button

Import the token file once from your global stylesheet:

@import './styles/bambi.css';

Then import the component:

import { Button } from './components/ui/button';
<Button intent="primary">Primary</Button>
<Button intent="secondary">Secondary</Button>
<Button appearance="outline">Outline</Button>
<Button appearance="ghost">Ghost</Button>
<Button appearance="link">Link</Button>
<Button intent="danger">Danger</Button>
<Button intent="success">Success</Button>
<Button intent="warning">Warning</Button>
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>

Icon-only buttons. Always provide aria-label for accessibility.

<Button size="icon" intent="primary" aria-label="Add">
<PlusIcon />
</Button>
<Button size="icon" intent="secondary" aria-label="Add">
<PlusIcon />
</Button>
<Button size="icon" intent="danger" aria-label="Delete">
<PlusIcon />
</Button>
<Button intent="primary">
<PlusIcon />
Add
</Button>
<Button intent="danger">
<TrashIcon />
Delete
</Button>

Override --bambi-button-radius to get pill-shaped buttons.

import './button.css';
<Button className="btn-rounded" intent="primary">Primary</Button>
<Button className="btn-rounded" intent="secondary">Secondary</Button>
<Button className="btn-rounded" appearance="outline">Outline</Button>
/* button.css */
.btn-rounded { --bambi-button-radius: 9999px; }
<Button style={{ width: '100%' }}>Full Width Primary</Button>
<Button style={{ width: '100%' }} intent="secondary">Full Width Secondary</Button>
<Button style={{ width: '100%' }} appearance="outline">Full Width Outline</Button>

Pass loading to show a spinner and block interaction. The button keeps its original width and the label remains accessible to screen readers.

<Button intent="primary" loading>Save</Button>
<Button intent="secondary" loading>Save</Button>
<Button intent="danger" loading>Delete</Button>
<Button intent="primary" disabled>Primary</Button>
<Button intent="secondary" disabled>Secondary</Button>
<Button intent="danger" disabled>Danger</Button>
PropTypeDefaultDescription
intent'primary' | 'secondary' | 'danger' | 'success' | 'warning''primary'Semantic meaning
appearance'solid' | 'outline' | 'ghost' | 'link''solid'Visual treatment
size'sm' | 'md' | 'lg' | 'icon''md'Button size
loadingbooleanfalseShows spinner and prevents interaction
disabledbooleanfalseDisables the button
type'button' | 'submit' | 'reset''button'HTML button type

All other HTML button attributes (aria-*, style, class) are forwarded to the underlying <button> element.