v3 is a plugin, not a bag of exports. You always install two pieces. The build
plugin generates the config, the icon registry and the typed variant lists,
ships the stylesheet as a CSS file and imports each v-bb-* directive where a
template uses it. The runtime plugin provides the icons and renders the host
that shows confirms and toasts. Without the build plugin the app does not
build; without the runtime plugin icons, confirms and toasts have nothing behind
them.
Install the package
In a Vue + Vite, Nuxt or Laravel + Inertia app, one command does the wiring below for you:
npx bitboss-ui@beta setup
It installs the package, vee-validate and @iconify-json/lucide, adds the
build plugin and the runtime plugin, the ESLint rules when the app has ESLint,
and a postinstall that keeps the agent files current.
A file it does not recognise is left alone, with the snippet to paste printed
instead. It commits nothing, and a second run changes nothing: review it with
git diff. --manual asks before each step.
By hand:
npm install bitboss-ui@beta
npm install -D @iconify-json/lucide
Confirm what you got before going further. @latest is the v2 line until
v3 goes stable.
# must report 3.0.0-*
npm ls bitboss-ui
Peers. Vue ^3.5.42 is the only required one. The optional ones you may
meet: @inertiajs/vue3 (2 or later) in Inertia apps, and vee-validate (4.10
or later, below 5) for BbForm. A build that meets
BbForm without vee-validate stops and prints the install command. The Nuxt
module needs Nuxt 4.6.3 or later.
Node. 20.19 or later, or 22.12 or later on the 22 line. The bitboss-ui
command line needs the same.
Browsers. Evergreen only, with no polyfills. Every floating surface (select, dropdown, popover, tooltip) uses the native Popover API, so the floor is Chrome and Edge 114, Safari 17 and Firefox 125. Below it those surfaces do not render.
Upgrading. Restart the dev server after installing a new version, and
delete node_modules/.vite (inside the container under Docker or Sail). A
server left running keeps serving the old JavaScript next to the new CSS, which
looks like a regression; the console warns when the two disagree. The first
start prints the command that lists what broke since your previous version:
npx bitboss-ui changelog --since <previous-version>
The build plugin
Nuxt. The module wraps the Vite plugin and registers the runtime plugin for
you, so you write no app.use:
export default defineNuxtConfig({
modules: ['bitboss-ui/nuxt'],
});
Vite (Vue, Laravel with Inertia). Add the plugin, then install the runtime plugin yourself in the next section:
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { bitbossUi } from 'bitboss-ui/vite';
export default defineConfig({
plugins: [vue(), bitbossUi()],
});
You configure everything here, at build time: the Nuxt bitboss key and
bitbossUi({ … }) take the same options. An option the plugin
does not know stops the build and names the closest one. The one exception is
locale: it can change at runtime through useBbConfig(), and
app.use(bitbossUiPlugin, { locale }) sets it per app (per request under SSR).
The library's own strings (empty states, close buttons, pagination) are English
unless you set locale. An app in another language names it:
bitbossUi({ locale: 'it' }), or bitboss: { locale: 'it' } in Nuxt.
The plugin writes bitboss-ui.d.ts into your project the first time the dev
server starts or you build. It lands next to your first script entry
(resources/js/ in a Laravel app), else in src/, and in app/ under Nuxt 4.
The dts option moves it. The file types your custom variants, enabled locales
and config scopes. Commit it, so a teammate's or CI's typecheck agrees
without running Vite.
Styles and the runtime plugin
The build plugin ships the library stylesheet as its own CSS file
(bitboss-ui-styles-<hash>.css), linked before your CSS and in the server's
HTML under SSR. Do not also @import bitboss-ui/styles.css in your CSS
while injectStyles is on. That second copy loads unlayered and beats your
Tailwind utilities again; npx bitboss-ui check reports it as
hand-imported-styles. A script's import 'bitboss-ui/styles.css' is the same
file, so it does no harm.
Vite. Install the runtime plugin at the entry point, with no CSS import:
import { createApp } from 'vue';
import { bitbossUiPlugin } from 'bitboss-ui';
import App from './App.vue';
createApp(App).use(bitbossUiPlugin).mount('#app');
In an Inertia app the same .use(bitbossUiPlugin) goes in createInertiaApp's
setup, after Inertia's own plugin (see Inertia).
Nuxt. The module installs the runtime plugin.
Directives. v-bb-tooltip, v-bb-dropdown, v-bb-popover and the other
v-bb-* directives are imported where a template uses them
(injectDirectives, on by default), so you register none, wherever
bitbossUi() sits in plugins. A use the build cannot see, such
as a template compiled at runtime or a prebundled dependency, loads its
directive on first mount and warns in development. List those to register them
upfront: injectDirectives: ['tooltip'].
The host. confirm(), toast() and on-demand dialogs
render in a <BbHost />, and the runtime plugin renders one beside your app
when it mounts, in Vue, Nuxt and Inertia alike. You mount nothing. Place a
<BbHost /> yourself only when an area of the app needs its own look for
toasts (see Passthrough): a placed host takes
over from the plugin's while it is mounted.
Reset. The components expect a reset underneath them: sizes are written for
border-box, and native controls must arrive without browser chrome. Tailwind's
Preflight is one. If you run none, add the library's with resetCss: true. It
also sets a system-ui font stack on body at zero specificity, so any
font-family of yours wins. The library has no font token and inherits your
font, so set font-family on body either way. The reset takes the browser
chrome off the controls inside the components only: a native checkbox, radio,
range, select or button your app renders itself keeps its native look, in the
brand colour (accent-color).
Who wins a tie between your CSS and the library depends on how your CSS loads:
- Plain CSS: leave
cssLayersunset. Source order decides: the library loads first, so your CSS wins. - Tailwind v3: leave
cssLayersunset and turninjectStylesoff (below). The source order you set decides. - Tailwind v4: set
cssLayerstoTAILWIND_V4_LAYERS. Your utilities win, always. - Other layered CSS: set
cssLayersto your full layer order, with'bitboss-ui'in it. Your layer order decides.
With other layers, put 'bitboss-ui-reset' directly before 'bitboss-ui' when
resetCss is on.
Tailwind v4
Tailwind v4 puts its utilities in a cascade layer, and layered CSS loses to the
library's unlayered CSS on every property the library sets. px-6 or
rounded-lg on a BbButton then does nothing. Set cssLayers to slot the
library in below the utilities:
import { bitbossUi, TAILWIND_V4_LAYERS } from 'bitboss-ui/vite';
bitbossUi({ cssLayers: TAILWIND_V4_LAYERS });
In Nuxt the same line goes in the bitboss block, with the constant imported
from bitboss-ui/nuxt at the top of nuxt.config.ts. You add no @layer line to
your own CSS.
One rule stays yours to keep: your own element resets, such as
a { color: inherit }, beat the library too when they sit outside a layer.
Write them inside @layer base, where the library outranks them.
Tailwind v3
Preflight is ordinary unlayered CSS that loads after the library's file, so its
element resets win ties against the components. Turn injectStyles off and
import the sheet after your Tailwind entry:
bitbossUi({ injectStyles: false });
import './app.css';
import 'bitboss-ui/styles.css';
The library now also wins ties against your utilities. To have utilities win on
v3, wrap Tailwind's output in layers and list the same layers in cssLayers.
Both halves must agree. injectStyles goes back on, so drop
injectStyles: false and the bitboss-ui/styles.css import: the plugin's file
carries the layer itself.
@layer tailwind-base, bitboss-ui-reset, bitboss-ui, tailwind-utilities;
@layer tailwind-base {
@tailwind base;
}
@layer tailwind-utilities {
@tailwind components;
@tailwind utilities;
}
import { bitbossUi, TAILWIND_V3_LAYERS } from 'bitboss-ui/vite';
// ['tailwind-base', 'bitboss-ui-reset', 'bitboss-ui', 'tailwind-utilities']
bitbossUi({ cssLayers: TAILWIND_V3_LAYERS });
Use the constant rather than retyping the order: a list that drifts from the
@layer line loses every tie in silence. In Nuxt, import it from
bitboss-ui/nuxt.
On v3, also set passthroughDeduper: false, or point it at a module using
tailwind-merge@2: the bundled merger speaks Tailwind v4 class names.
Server rendering
The stylesheet is a CSS file, so the server's HTML is styled on the first paint.
Nuxt: nothing to do. The module adds the stylesheet to the page's CSS
itself, ahead of your own and layered when cssLayers is set.
Vite SSR and Inertia SSR: nothing to do. The file is a CSS import of the module that installs the runtime plugin, so your server links it like any CSS your entry imports. To place it yourself instead, import it into its layer from your CSS entry and turn the plugin's file off:
@layer theme, base,
bitboss-ui-reset, bitboss-ui,
components, utilities;
@import 'tailwindcss';
@import 'bitboss-ui/styles.css' layer(bitboss-ui);
bitbossUi({ cssLayers: TAILWIND_V4_LAYERS, injectStyles: false });
The @layer line comes first: it fixes the order before Tailwind declares its
own layers, and with the plugin's file off nothing else declares the library's.
Nuxt on Tailwind v3, where the library has to load after Preflight: list
the stylesheet in css, after your Tailwind entry, and turn the plugin's file
off: css: ['~/assets/css/main.css', 'bitboss-ui/styles.css'] with
bitboss: { injectStyles: false }.
Text on coloured fills
Where you did not set a text colour on a fill (a primary button, a status
badge, an avatar color), the library picks black or white for it. The
contrast option chooses the rule, app-wide:
bitbossUi({ contrast: 'optical' }); // Nuxt: bitboss: { contrast: 'optical' }
'wcag', the default: white only where it reaches 4.5:1 on the fill, so every automatic label passes WCAG AA. Mid-tone fills get black text.'optical': white on every fill darker than luminance 0.30. It reads better on mid-tones, but there it fails WCAG AA for normal-size text.
For one part of a page, put class="bb-contrast-optical" (or
bb-contrast-wcag) on its root element. A -fg token you pinned yourself is
never changed. Design tokens covers the tokens.
Icons
Icon names are provider-first: lucide:plus resolves from the installed
@iconify-json/* package, and local:logo resolves from your own SVG directory.
icons.dir defaults to ./assets/icons, resolved from the Vite root. In a
Vite app that is the project root, so icons under src/ need
icons: { dir: './src/assets/icons' }. In Nuxt 4 the root is app/, so the
default already means app/assets/icons. Writing ./app/assets/icons points
one level too deep, and every local:* icon then renders as a question mark, in
production too.
Drop an SVG in that directory and it is available as local:<filename>.
Provider names built at runtime, which the build cannot see as literals, go in
icons.whitelist. The same option swaps the library's own icons, such as the
close ✕ or the select chevron. Icons has the rest.
Options most apps set
The same options go in bitbossUi({ … }) and in Nuxt's bitboss key. The ones
most apps touch, by what they control:
Language and icons:
locale: the language of the library's own strings, and the formats around them. Default'en'. It is the one option you can change at runtime. See Locales.enabledLocales: which of the built-in locales enter the bundle. Default: yourlocaleplus'en'.icons:dir, the folder of SVG files forlocal:*icons, from the Vite root (default'./assets/icons');whitelist, provider icons that always ship, for names built at runtime, such as'lucide:flag'or'tabler:calendar-*';defaults, the library's own icons swapped app-wide. See Icons.
Styles:
cssLayers: places the library in your cascade layer order,TAILWIND_V4_LAYERSfor Tailwind v4. Unset by default.injectStyles: ships the stylesheet as its own CSS file. Defaulttrue; set itfalsewhen you import the stylesheet yourself.resetCss: adds the library reset to that file,system-uibody font included. Defaultfalse.contrast: how the automatic black or white text on fills is picked,'wcag'(default) or'optical'. See Text on coloured fills.
Components:
components: defaults,pt, variants and size scales, keyed by component. See the next section.configScopes: the same map for one area of the app, switched on by<BbConfigScope>. See Passthrough.
Phones and the server render:
mobileMaxWidth: the width in pixels below which the mobile layouts apply, and dialogs, popovers, dropdowns and selects open as bottom sheets. Default768.ssrViewportWidth: the screen width the server renders for, since it cannot measure one. Default1024.
Tooling:
ai: keeps the agent files and the MCP server current, for the agent tools the repo uses, on every install and dev start. Defaulttrue;falsestops all of it.allowComponents: your own globally registeredBb…components, whichnpx bitboss-ui checkshould skip.vscodeSettings: letssetupandupdate, run by hand, write editor hints to.vscode/settings.json. Defaulttrue.
The options are typed, so your editor lists the rest: injectDirectives,
dts, iconsScanner, passthroughDeduper and the link settings
(inertiaLinkName, nuxtLinkName, linkActiveClass). The complete reference
ships in the package, at
node_modules/bitboss-ui/dist/ai/guides/installation-and-plugin-setup.md.
Defaults for every component
Everything a component reads from your build config lives in one map,
components, keyed by component and written with the component's own prop
names. A back office that is dense everywhere, with floating labels and small
buttons:
bitbossUi({
components: {
all: { compact: true, labelMode: 'floating' },
BbButton: { size: 'sm' },
BbToast: { position: 'top-end' },
},
});
all reaches every component that has the prop, and nothing else: compact
above makes every component with a compact prop dense. A prop only some
components share, such as size, goes on the component. An instance's own
prop still wins, so :compact="false" undoes the default for one field.
Only a set of props can be defaulted. The ones you will reach for:
| Where | What it sets |
|---|---|
all | adaptive (bottom sheets on phones, default true), labelMode, validationMode, compact, clearable, autocomplete, the layout props (layout, reverse, inputPosition, …), today (the day the calendars mark as today, an ISO day such as '2025-12-11') |
all only | requiredAsterisk (default true), autoDisableWritingThreshold (default 6), popoverOffset (default 4) |
BbButton, BbBadge | variant, size |
BbTextInput, BbTextarea | nullValue: 'string' makes an emptied field emit '' instead of null (app-wide only) |
BbTextInput, BbSelect | minQueryLength and queryDebounceTime, how many characters a search needs and how long it waits for typing to stop |
BbNumberInput | disableFormatting, maxPrecision |
BbToast | position, the corner toasts stack in (default 'bottom-end'), and duration |
BbTooltip | delay, the hover wait before a tooltip opens |
BbConfirm | size, the width of every confirm, from 'xs' to '2xl' (compact by default) |
BbDialog, BbOffCanvas, BbIcon, BbAvatar, BbRating | sizeMap: name only the sizes you change, { lg: 720 } |
Every entry also takes pt (see Passthrough),
and the components with variants take variants, the names your app adds (see
Design language). The editor
completes the rest; the complete list ships in the package guide above.
The map is data, checked at build time. A function in it, a key in the wrong
place (BbButton: { adaptive: false }) or a removed option fails the build
and names where the key goes. A real map grows, so keep it in a file of its
own, typed with satisfies:
import type { BbComponentsMap } from 'bitboss-ui/vite'; // 'bitboss-ui/nuxt' in Nuxt
export const components = {
all: { compact: true },
BbTextInput: { nullValue: 'string', pt: { label: 'text-xs' } },
} satisfies BbComponentsMap;
import { components } from './bitboss-ui.components';
bitbossUi({ components });
An area with its own look or layout, such as a settings page whose fields sit
beside their labels, takes the same map as a config scope.
Inside a scope, a key set to libraryDefault (exported from bitboss-ui) gets
the component's own default back.
A clearable default puts a ✕ on required fields too, where one tap wipes a
value the user must then enter again. Set it on a scope around a filter bar
rather than app-wide.
Locales
locale sets more than the words. It sets the formats around them: the long
date, the first day of the week, the order of a date field's parts, the AM / PM
words, and how a number field groups
what the user types.
The list is fixed and typed. A bare language is its default region: en is
en-US, it is it-IT, pt is pt-BR and zh is zh-CN.
| Language | Default | Regions, same words | Own dictionary |
|---|---|---|---|
| English | en (US) | en-GB, en-AU, en-CA, en-IE | |
| German | de | de-AT | de-CH |
| French | fr | fr-BE, fr-CA, fr-CH | |
| Italian | it | it-CH | |
| Dutch | nl | nl-BE | |
| Swedish | sv | sv-FI | |
| Spanish | es (Spain) | es-MX (Mexico) | |
| Portuguese | pt-BR (Brazil) | pt-PT (Portugal) | |
| Chinese | zh-CN (Simplified) | zh-TW (Taiwan), zh-HK (Hong Kong): Traditional | |
| One region each | ar cs da el fa fi he hu ja ko nb pl ro ru tr uk |
A region reads its language's words and keeps its own formats: de-CH groups
1’234.5, en-GB starts the week on Monday and orders dates DD/MM/YYYY,
en-CA starts it on Sunday, and fr-CA orders them AAAA-MM-JJ. The English
regions spell the British way (colour), and de-CH writes ss for ß. Where the
words themselves differ, the region has a dictionary of its own: Mexican
Spanish, European Portuguese (its week starts on Sunday, as CLDR has it), and
Traditional Chinese for Taiwan and Hong Kong.
bitbossUi({
locale: 'en-GB',
enabledLocales: ['fr-CA', 'de-CH'],
});
pt-BRandzh-CNare the canonical spellings. Codes are case-insensitive, sozh-cnstill works, and a default region's full code is the same locale (it-ITisit).- A code that is not on the list is a type error. In a component,
npx bitboss-ui checkalso flags it and names the nearest one: forsetConfig({ locale: 'en-UK' })it asks whether you meanten-GB. - Selecting a locale you did not enable is a compile error, not a runtime
fallback.
enabledLocalesdecides what ships; at runtimeuseBbConfig().setConfig({ locale })switches among those only. There is deliberately no'all': each dictionary is a bundle cost you should see in the config. - There is no way to add your own. A language or region that is missing is a request for the library, not a dictionary in your app.
- One section can use another locale.
<BbConfigScope locale="fa">switches the words, the formats and the calendar inside it only, dialogs and pickers opened there included; the rest of the page keeps the app's. It takes one of the localesenabledLocalesships, and the nearest scope'slocalewins.
Right-to-left. Arabic (ar), Hebrew (he) and Persian (fa) change the
words, not the direction. Set dir="rtl" on <html> with the locale (and in
the server's HTML under SSR), and the components lay out from the right.
start and end, in a toast corner, an off-canvas side or a popover
placement, follow the direction; left and right stay where they say.
document.documentElement.dir = ['ar', 'he', 'fa'].includes(locale) ? 'rtl' : 'ltr';
Imports and the type gate
Import components explicitly:
<script setup lang="ts">
import { BbButton, BbSelect } from 'bitboss-ui';
</script>
The Nuxt module can auto-import them instead, with autoImport: true in the
bitboss block. Leave it off, which is the default. Explicit imports are what
let the next setting catch a mistyped or removed component at type-check time:
{
"vueCompilerOptions": {
"checkUnknownComponents": true,
"strictTemplates": true
}
}
strictTemplates does the same for a misspelled prop. Run both through
vue-tsc 3. Under 2.x, the props of the generic components (BbSelect,
BbSelectPopover, BbTable, BbTabs, BbTabsRoot, BbTree, BbForm and
the checkbox, radio and switch groups) go unchecked while everything else still
errors, so the gate looks healthy. Keep TypeScript at 5.x or 6.x: vue-tsc
cannot load TypeScript 7 yet.
With auto-imports on, every Bb* tag resolves, so this check and the
bitboss-ui/no-unimported-component ESLint rule both go quiet.
Your first component
A select of team members, from the objects your API returns:
Stored value: 27
<template>
<div class="grid max-w-sm gap-3">
<BbSelect
id="assignee"
v-model="assignee"
label="Assignee"
name="assignee"
item-text="fullName"
item-value="id"
:items="users"
clearable
/>
<p class="m-0 text-sm text-[var(--bb-text-muted)]">
Stored value: <code class="font-mono">{{ assignee ?? 'null' }}</code>
</p>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { BbSelect } from 'bitboss-ui';
// Domain objects as they come from your API: no mapping to { label, value }.
const users = [
{ id: 14, fullName: 'Ada Okonkwo', team: 'Platform' },
{ id: 27, fullName: 'Luca Ferrari', team: 'Billing' },
{ id: 31, fullName: 'Mei Tanaka', team: 'Support' },
{ id: 48, fullName: 'Tomás Herrera', team: 'Platform' },
];
const assignee = ref<number | null>(27);
</script>
label is required: it is the accessible name. Pass your domain objects to
items as they are, then name the display field (item-text) and the stored
value (item-value). You never map them to { label, value } pairs first.
Objects that already carry label and value need neither prop.
Where to go next
Choose the next page by task:
- Upgrading from 2.x: read Migrating from v2 before changing call sites. Several boolean defaults changed without a type error.
- Building with Nuxt: continue with the Nuxt module.
- Building with Laravel: continue with Inertia and Laravel.
- Loading choices from an API: start with Options and items, then Fetching data.
- Adding validation: wrap the fields in a
BbForm, as Validated forms shows. - Theming: generate the first CSS block in the theme builder, then use Design tokens to review each value.
- Using a coding agent: run the setup in AI agents, then add the markup check to CI.