Button

The standard action button. Use <button class="btn"> for actions and <a class="btn"> only for navigation styled as a button. Appearance variants set emphasis (primary for the single main action, danger/warning for destructive/risky ones); .active marks a toggled-on state; group related buttons inside .btn-group.

Root: .btn on <button>, <a>

Examples

Example 1
<button class="btn btn-primary">Create</button>
Example 2
<div class="btn-group"><button class="btn">Days</button><button class="btn active">Weeks</button><button class="btn">Months</button></div>

Contract

Variants & modifiers

ClassAxisRules
btn-primaryappearanceoptional · exclusive
btn-warningappearanceoptional · exclusive
btn-dangerappearanceoptional · exclusive
btn-subtleappearanceoptional · exclusive
btn-linkappearanceoptional · exclusive
btn-subtle-linkappearanceoptional · exclusive
btn-compactmodifieroptional
btn-iconmodifieroptional
btn-blockmodifieroptional
activemodifieroptional
disabledmodifieroptional

Accessibility

OnAttributeLevelWhen
.btn-iconaria-labelrequired

Prefer the native disabled attribute on <button> over the .disabled class (the class removes pointer events but a link stays focusable). On <a class="btn"> used as an action, add role="button". .btn-group is a plain flex wrapper of direct .btn children — give it role="group" plus aria-label when the grouping is semantic (e.g. a segmented control).

Nesting

Allowed in:

  • forms
  • .navbar-actions
  • .modal-footer
  • .message-actions
  • .btn-group (as direct child)
  • toolbars

Never inside (or containing):

  • .btn