Skip to content

Button

.bp-btn is the primary action element. Works as <button> or <a> with no JS. Variants are modifier classes. The public API lets consumers restyle without touching internals.

Variants

<button class="bp-btn" type="button">Primary</button>
<button class="bp-btn bp-btn--secondary" type="button">Secondary</button>
<button class="bp-btn bp-btn--ghost" type="button">Ghost</button>
<button class="bp-btn bp-btn--danger" type="button">Danger</button>

Sizes

<button class="bp-btn bp-btn--sm" type="button">Small</button>
<button class="bp-btn" type="button">Default</button>
<button class="bp-btn bp-btn--lg" type="button">Large</button>

Icon only

<button class="bp-btn bp-btn--icon" type="button" aria-label="Settings"></button>
<button class="bp-btn bp-btn--icon bp-btn--secondary" type="button" aria-label="Close"></button>
<button class="bp-btn bp-btn--icon bp-btn--ghost" type="button" aria-label="More"></button>

Disabled

<style>
.demo-btn--aria-disabled[aria-disabled="true"] { pointer-events: none; opacity: 0.5; }
</style>
<button class="bp-btn" type="button" disabled>Disabled</button>
<button class="bp-btn bp-btn--secondary demo-btn--aria-disabled" type="button" aria-disabled="true"
onclick="return false">
Aria disabled
</button>

aria-disabled="true" keeps the button in the tab order (useful when you want to explain why it’s disabled via a tooltip). You must also add pointer-events: none and prevent the click handler — unlike disabled, the browser does not do this automatically.

VariableDefaultDescription
--btn-bgvar(--bp-primary)Background color
--btn-colorvar(--bp-primary-fg)Text color
--btn-radiusvar(--bp-radius-md)Border radius
--btn-paddingvar(--bp-space-3) var(--bp-space-6)Padding shorthand
--btn-bordernoneBorder
--btn-bg-hovervar(--bp-primary-hover)Background on hover

Custom CTA via public API

<style>
.btn-cta {
--btn-bg: var(--bp-color-success);
--btn-radius: var(--bp-radius-full);
--btn-padding: var(--bp-space-3) var(--bp-space-8);
}
</style>
<button class="bp-btn btn-cta" type="button">Get started free</button>
ClassDescription
bp-btn--secondarySubtle background + border
bp-btn--ghostTransparent background, brand text
bp-btn--dangerError color background
bp-btn--iconSquare aspect ratio, icon-only
bp-btn--smSmaller padding and font size
bp-btn--lgLarger padding and font size
No axe violations tested 2026-05-11
  • Use <button type="button"> for actions, <a> for navigation.
  • Icon-only buttons must have aria-label.
  • :focus-visible is always present — never hidden.
  • Disabled state uses aria-disabled="true" + CSS pointer-events: none.
APIAvailabilityUsed forWithout itPolyfill
Container Queries Widely available Baseline 2023 Compact layout and full-width at small container sizesStatic layout at all sizesNone needed
cqi units Widely available Baseline 2023 Fluid font-size that scales with container widthFixed font-size from tokensNone needed

Do not set these directly — they are component-private:

  • --_bg — resolves from --btn-bg
  • --_color — resolves from --btn-color
  • --_radius — resolves from --btn-radius
  • --_padding — resolves from --btn-padding
  • --_border — resolves from --btn-border