Button
Buttons trigger actions. Put btn on a <button> or <a>, then add color, style, size and state modifiers.
Class names
| Class name | Type | Description |
|---|---|---|
btn | Component | Base button |
btn-primary | Color | Primary color |
btn-secondary | Color | Secondary color |
btn-danger | Color | Danger color, for destructive actions |
btn-outline | Style | Transparent with a border; fills on hover |
btn-ghost | Style | No background or border until hover |
btn-sm | Size | Small |
btn-lg | Size | Large |
btn-loading | State | Shows a spinner; pair with aria-busy="true" |
Button
<button class="btn">Default</button>Colors
<button class="btn btn-primary">Primary</button>
<button class="btn btn-secondary">Secondary</button>
<button class="btn btn-danger">Danger</button>Outline
<button class="btn btn-outline">Outline</button>Ghost
<button class="btn btn-ghost">Ghost</button>Sizes
Medium is the default; there is no btn-md class.
<button class="btn btn-sm">Small</button>
<button class="btn">Medium</button>
<button class="btn btn-lg">Large</button>Sizes with color
<button class="btn btn-primary btn-sm">Small</button>
<button class="btn btn-primary">Medium</button>
<button class="btn btn-primary btn-lg">Large</button>Disabled
Use the disabled attribute on <button>, or aria-disabled="true" on a link.
<button class="btn" disabled>Disabled</button>
<a class="btn btn-primary" aria-disabled="true">Disabled link</a>Loading
The label stays in the DOM, so screen readers still announce it.
<button class="btn btn-loading" aria-busy="true">Saving</button>
<button class="btn btn-primary btn-loading" aria-busy="true">Saving</button>With an icon
<button class="btn btn-primary">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>
New file
</button>Link styled as a button
<a class="btn btn-outline" href="#">Read the docs</a>