Skip to content

BbButton

Build actions and button-shaped links with loading, accessible names, and a consistent visual hierarchy.

import { BbButton } from 'bitboss-ui';

On this page

Use it for

Use BbButton for actions the user performs — save, delete, submit — and for destinations that need button styling. Actions use @click or type="submit"; navigation uses href or to.

Use something else when

  • BbDropdownButton — one dominant action has close alternatives: Save / Save as draft
  • BbDropdown — no action dominates
  • BbBaseButton — the surface is clickable with no button chrome at all: a table row, a card

Pass Through

Hover or tap a part to outline it. Toggles flip loading, errors and warnings when the component has them — only parts highlight.

Default

BbButton is the library's button, and its label is slot content. type defaults to button, so inside a form the only button that submits is the one you mark type="submit".

The variant ladder

Variants are a hierarchy, not a palette: one primary per region of the page, then secondary, outline, ghost.

Keep destructive for what cannot be undone. link recolors the button without changing its box, so it is the wrong choice for an inline text link.

Sizes and width

Six sizes, xs through 2xl, derived from the global --bb-control-h scale, so height, padding, text and icons move together. md is the default and lines up with a compact field; block stretches the button to its container.

Icons

prepend:icon and append:icon put an icon beside the label. For an icon-only button use icon and keep writing the label in the slot — it is hidden visually and still announced. Use aria-label only when that accessible name must differ from the slot text; never ship an icon-only button with neither.

Async actions

A click handler that returns a promise puts the button into its loading state until the promise settles and blocks repeat clicks. Fire-and-forget work is not trackable; return the promise or bind loading to the state that owns it.

No changes saved yet.
Coming from v2

In v2 this was opt-in through auto-loading. Delete that prop in v3. Use disable-auto-loading only when you intentionally need the old behaviour.

A submit button has no async @click handler to track. Bind loading to form or request state instead; BbForm exposes isSubmitting for returned submit work.

Pass href or to instead of navigating from a click handler. The result is a real link with middle-click, open-in-new-tab and copy-address behaviour.

Toggles and exclusive sets

v-model operates the button as a toggle between true-value and false-value. Seed the model — an undefined value swallows the first click.

For an exclusive set, share one model and give each button its own true-value, with false-value pointing at that same value so the selection is mandatory.

Off

Custom variants

Register a name in the plugin config and it becomes a typed value of variant:

ts
// nuxt.config.ts
export default defineNuxtConfig({
    bitboss: { buttonVariants: ['upgrade'] },
});

The library ships no CSS for registered variants — you style .bb-button--upgrade yourself through the same local properties as the built-in variants.

Use BbBaseButton instead when the control needs a completely custom shape such as a card, row or inline link. A custom variant is still a button; the base component is the primitive.

css
.bb-button--upgrade {
    --bg: var(--bb-primary);
    --bg-hover: color-mix(in oklab, var(--bb-primary) 90%, black);
    --bg-pressed: color-mix(in oklab, var(--bb-primary) 80%, black);
    --fg: var(--bb-primary-fg);
    --ring: var(--bb-ring);
}
Coming from v2v2 tooltip and theme props

Replace tooltip* props with v-bb-tooltip or BbTooltip. Replace theme with a built-in or registered variant; unregistered variant names are now type errors.