Button
Installation
Section titled “Installation”npx @bambiui/cli initnpx @bambiui/cli add buttonImport the token file once from your global stylesheet:
@import './styles/bambi.css';Then import the component:
import { Button } from './components/ui/button';<script> import { Button } from './components/ui/button';</script><script setup>import { Button } from './components/ui/button';</script>---import { Button } from './components/ui/button';---Intent And Appearance
Section titled “Intent And Appearance”<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 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 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 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><Button size="sm">Small</Button><Button size="md">Medium</Button><Button size="lg">Large</Button><Button size="sm">Small</Button><Button size="md">Medium</Button><Button size="lg">Large</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 size="icon" intent="primary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="secondary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="danger" aria-label="Delete"><svg>...</svg></Button><Button size="icon" intent="primary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="secondary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="danger" aria-label="Delete"><svg>...</svg></Button><Button size="icon" intent="primary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="secondary" aria-label="Add"><svg>...</svg></Button><Button size="icon" intent="danger" aria-label="Delete"><svg>...</svg></Button>With Icon
Section titled “With Icon”<Button intent="primary"><PlusIcon />Add</Button><Button intent="danger"><TrashIcon />Delete</Button><Button intent="primary"><svg>...</svg>Add</Button><Button intent="danger"><svg>...</svg>Delete</Button><Button intent="primary"><svg>...</svg>Add</Button><Button intent="danger"><svg>...</svg>Delete</Button><Button intent="primary"><svg>...</svg>Add</Button><Button intent="danger"><svg>...</svg>Delete</Button>Rounded
Section titled “Rounded”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 class="btn-rounded" intent="primary">Primary</Button><Button class="btn-rounded" intent="secondary">Secondary</Button><Button class="btn-rounded" appearance="outline">Outline</Button>
<style>.btn-rounded { --bambi-button-radius: 9999px; }</style><Button class="btn-rounded" intent="primary">Primary</Button><Button class="btn-rounded" intent="secondary">Secondary</Button><Button class="btn-rounded" appearance="outline">Outline</Button>
<style scoped>.btn-rounded { --bambi-button-radius: 9999px; }</style><Button class="btn-rounded" intent="primary">Primary</Button><Button class="btn-rounded" intent="secondary">Secondary</Button><Button class="btn-rounded" appearance="outline">Outline</Button>
<style>.btn-rounded { --bambi-button-radius: 9999px; }</style>Full Width
Section titled “Full Width”<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><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><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><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>Loading
Section titled “Loading”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" loading>Save</Button><Button intent="secondary" loading>Save</Button><Button intent="danger" loading>Delete</Button><Button intent="primary" :loading="true">Save</Button><Button intent="secondary" :loading="true">Save</Button><Button intent="danger" :loading="true">Delete</Button><Button intent="primary" loading>Save</Button><Button intent="secondary" loading>Save</Button><Button intent="danger" loading>Delete</Button>Disabled
Section titled “Disabled”<Button intent="primary" disabled>Primary</Button><Button intent="secondary" disabled>Secondary</Button><Button intent="danger" disabled>Danger</Button><Button intent="primary" disabled>Primary</Button><Button intent="secondary" disabled>Secondary</Button><Button intent="danger" disabled>Danger</Button><Button intent="primary" disabled>Primary</Button><Button intent="secondary" disabled>Secondary</Button><Button intent="danger" disabled>Danger</Button><Button intent="primary" disabled>Primary</Button><Button intent="secondary" disabled>Secondary</Button><Button intent="danger" disabled>Danger</Button>API Reference
Section titled “API Reference”| Prop | Type | Default | Description |
|---|---|---|---|
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 |
loading | boolean | false | Shows spinner and prevents interaction |
disabled | boolean | false | Disables 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.