shadcn-vue
The Examples tab uses this component. For Vue apps built with shadcn-vue and Tailwind CSS v4, Beehexa publishes its own registry. The Button keeps the shadcn-vue API, so existing code keeps working, and is styled with Beehexa design tokens instead of the shadcn defaults.
Install
Run these in the app, after shadcn-vue init:
npm install @beehexa/design-tokens
npx shadcn-vue@latest add https://beehexa.design/r/beehexa-theme.json
npx shadcn-vue@latest add https://beehexa.design/r/button.json
Then import the tokens and the theme after Tailwind:
@import 'tailwindcss';
@import '@beehexa/design-tokens/css';
@import './assets/beehexa-shadcn.css';
The theme maps the shadcn-vue colour and radius variables to Beehexa tokens, so the other shadcn-vue components follow Beehexa colours too. Dark mode follows data-theme="dark" on <html>, as on this site.
Use
<script setup lang="ts">
import { Ellipsis } from '@lucide/vue'
import { Button } from '@/components/ui/button'
</script>
<template>
<Button variant="outline">Test connection</Button>
<Button :loading="saving">{{ saving ? 'Saving…' : 'Save connection' }}</Button>
<Button variant="ghost-destructive" size="sm">Remove</Button>
<Button variant="ghost" size="icon" aria-label="More actions">
<Ellipsis />
</Button>
<Button as-child variant="outline">
<a href="/connections">All connections</a>
</Button>
</template>
Props
| Prop | Values | Default | Beehexa meaning |
|---|---|---|---|
variant |
default |
default |
Primary |
outline, secondary |
Default. Beehexa has no filled secondary, so both look the same | ||
ghost |
Subtle | ||
destructive |
Danger | ||
ghost-destructive |
Danger tone on a subtle button (Beehexa addition) | ||
link |
An action inside text; always underlined | ||
size |
sm, default, lg |
default |
24, 32 and 40 px; xs is the same as sm |
icon-sm, icon, icon-lg |
Icon-only squares of 24, 32 and 40 px; icon-xs is the same as icon-sm |
||
loading |
boolean |
false |
Beehexa addition: spinner in place of the icon, aria-busy, clicks ignored |
as, asChild |
'button' |
Render another element, such as a router link |
Pass aria-disabled="true" with aria-describedby for an unavailable button: it stays focusable and ignores clicks. Use disabled only for short waits.
The source lives in registry/beehexa/ in the beehexa.design repository; node scripts/build-registry.mjs writes the files served under /r/.
HTML and CSS, without a framework
On this site and in any page without Vue, Button is CSS only: add the classes to a native button, or to an a when it goes to another page. The styles ship in the site kit and use only design tokens.
| Class | Effect |
|---|---|
bh-button |
Required. Default variant, default size |
bh-button-primary |
Primary variant |
bh-button-subtle |
Subtle variant: no fill or edge at rest |
bh-button-danger |
Danger. With bh-button-subtle, the danger tone on a subtle button |
bh-button-small, bh-button-large |
24 px or 40 px instead of 32 px |
bh-button-icon |
Icon-only: a square of the button’s height |
bh-button-block |
Full width |
bh-button-row |
A row of buttons with space.100 between them; add is-end to align it to the end |
Attributes
| Attribute | When |
|---|---|
type="button" |
Always, unless the button submits a form (type="submit") |
aria-label |
Icon-only buttons. If the button also has visible text, the name must contain it |
aria-busy="true" |
While loading. Your code ignores clicks until it is removed |
aria-disabled="true" with aria-describedby |
Unavailable but focusable; point to the text that gives the reason |
disabled |
Short waits only; removes the button from the tab order |
aria-haspopup, aria-expanded |
The button opens a menu |
aria-pressed |
A toggle button in a toolbar |
target="_blank" rel="noopener noreferrer" |
Links that open a new tab; add an external-link icon and hidden text “(opens in a new tab)” |
Markup for each state
<!-- Loading: keep the label, swap the icon for the spinner -->
<button class="bh-button bh-button-primary" type="button" aria-busy="true">
<svg aria-hidden="true" class="bh-button-spinner" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
Syncing…
</button>
<!-- Unavailable: the reason is the button's description, shown in a tooltip on hover and focus -->
<button class="bh-button bh-button-primary" type="button"
aria-disabled="true" aria-describedby="sync-why">Run sync</button>
<div role="tooltip" id="sync-why" hidden>Connect an online store first.</div>
<!-- Icon only -->
<button class="bh-button bh-button-subtle bh-button-icon" type="button"
aria-label="Sync now" title="Sync now">…icon…</button>
The spinner is the Lucide loader-circle icon. kit.css turns it and shows it only once the wait passes motion.wait.spinner (1000 ms), so quick actions don’t flash it. Under reduced motion it keeps turning at the same speed: it shows that work is running.
Design tokens
Button uses functional tokens plus four component tokens for the neutral hover, pressed and toggle-on fills (see the Style tab). All of them point to functional tokens, so a theme change reaches the button without extra work.
| Part | Tokens |
|---|---|
| Primary | color.background.primary, .hover, .pressed; color.text.inverse |
| Default | color.surface, color.border, color.text; button.background.subtle.hover, .pressed; color.border.hover |
| Subtle | transparent; button.background.subtle.hover, .pressed |
| Toggle on and open menu | button.background.selected, button.border.selected; button.background.subtle.pressed |
| Danger | color.background.danger.bold, .hover, .pressed; color.text.on-bold |
| Danger tone on subtle | color.text.danger; color.background.danger.subtle.hover, .pressed |
| Disabled and unavailable | color.background.disabled, color.border.disabled, color.text.disabled |
| Focus | color.border.focus, border.width.focused, state.focus.offset |
| Size | size.control.small, .default, .large; space.control.x.small, space.control.x, space.control.x.large; space.control.gap; size.icon.default |
| Shape and text | radius.control, radius.control.small; border.width.default; font.label.default, font.label.small |
| Motion | motion.control for colour changes |
Limitations
- Labels don’t wrap. Keep them short instead.
- The related buttons are separate components: icon button, button group, menu button, split button, toggle button, toolbar, action bar and segmented control.