@beehexa/shadcn-vue holds every component of the shadcn-vue registry, styled with Beehexa tokens, as one npm package. It is compiled from the same files the copy-paste registry serves, so both always match. The API is shadcn-vue’s: same component names, props, slots and reka-ui primitives.
Install the package to follow the design system; use the registry only when an app must own a component’s code.
Package @beehexa/shadcn-vue |
Registry shadcn-vue add https://beehexa.design/r/<name>.json |
|
|---|---|---|
| Where the code lives | In node_modules |
Copied into the app |
| How a fix arrives | Bump the version | Add the component again, by hand, in every app |
| Who may change it | beehexa.design | The app |
Install
npm install @beehexa/shadcn-vue@<version> vue reka-ui
vue3.5 or later andreka-ui2.11 or later are peers: the app keeps one copy of each.- Everything else installs with the package, including
@beehexa/design-tokensat the same version. - Install the same version of every Beehexa package, and only a published one. Before a release, use a local reference, as in Develop.
Add the styles
The components carry Tailwind class names, not CSS. Choose one setup and import it once, in the app’s entry point.
App without Tailwind
@import '@beehexa/shadcn-vue/css';
./css is precompiled: the tokens and every component’s styles, in the beehexa cascade layer, without Tailwind’s reset, so the app’s own CSS is not restyled.
App with Tailwind CSS v4
For apps already set up for shadcn-vue:
@import 'tailwindcss';
@import 'tw-animate-css';
@import 'shadcn-vue/tailwind.css';
@import '@beehexa/design-tokens/css';
@import '@beehexa/shadcn-vue/tailwind';
/* Optional, while the app still has its own copied shadcn components: */
@import '@beehexa/shadcn-vue/theme';
./tailwindpoints the app’s Tailwind at the package, which Tailwind would otherwise skip. The app’s Tailwind then builds one set of styles for the app and the package together../thememaps shadcn-vue’s own variables (--primary,--background, …) to Beehexa tokens, so components the app copied earlier look the same as the package’s. Remove it with the last copied component.
Use the components
<script setup lang="ts">
import { Button } from '@beehexa/shadcn-vue/button';
</script>
<template>
<Button variant="outline">Sync</Button>
</template>
- Import each component from
@beehexa/shadcn-vue/<name>, named as on its component page.@beehexa/shadcn-vueexports all of them, and@beehexa/shadcn-vue/utilsexportscn. - Follow each component’s Usage page; the package changes how the code arrives, not the rules.
- Dark mode follows the tokens. Set
data-theme="dark"ordata-theme="light"on<html>. If the app toggles a.darkclass, setdata-themeat the same time.
Content Security Policy
The Content Security Policy standard asks every product for strict scripts and one of two style levels. The components look right at both. At the basic style level (style-src 'self' 'unsafe-inline') there is nothing to add. The rest of this section is for the strict level, style-src 'self'.
Remove reka-ui’s inline styles at build time
reka-ui 2 renders a small <style> element next to the Select, Combobox and Scroll area viewports to hide their scrollbar. At the strict level the policy blocks it, and the browser logs a style-src-elem error each time one of them appears. Add the package’s Vite plugin to the app’s build:
// vite.config.ts
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import { removeRekaInlineStyles } from '@beehexa/shadcn-vue/vite';
export default defineConfig({
plugins: [removeRekaInlineStyles(), vue()],
});
- What it does. When Vite builds the app, it removes the code that renders that
<style>from three reka-ui files:Select/SelectViewport.js,Combobox/ComboboxViewport.jsandScrollArea/ScrollAreaViewport.js. Nothing else changes. The components hide those scrollbars with their own classes (see below), so the built app looks the same, and the strict policy logs no error. - Build only. The plugin does not run in
vite dev. The dev server adds the app’s own CSS as<style>elements anyway, so don’t turn the strict policy on in development: check it on the built app, for example withvite previewbehind the same header. - It never stops a build. A file that no longer renders the
<style>is left as it is. If reka-ui changes the code around it, the plugin leaves the file unchanged and prints a warning in the build output; the look stays right, and the browser logs the error again until the plugin is updated. - Apps not built with Vite see the known error when they open a Select, Combobox or Scroll area at the strict level. The look is still right, from the components’ classes.
- Server rendering with the plugin is not checked yet.
- Checked in Chromium and Firefox, on an app built from the packed package: no CSP error when opening Select, Combobox and Scroll area, scrollbars hidden, lists scroll and work with the keyboard. Safari is not checked yet.
- It is temporary. reka-ui 3.0.0-alpha.0 no longer renders the
<style>in Select and Combobox. The plugin goes once the package moves to a reka-ui that renders none.
reka-ui also exports a general Viewport (dist/Viewport/Viewport.js) that renders a fourth <style>, for [data-reka-viewport]. The package does not use it, and the plugin does not touch it.
How the components hide scrollbars
The Select, Combobox and Command lists and the Scroll area viewport hide the browser’s scrollbar with their own classes, [scrollbar-width:none] and [&::-webkit-scrollbar]:hidden (Components › Scrollbar, D35). A long list has no browser scrollbar and a Scroll area shows only its own bar, with or without reka-ui’s <style>. The classes are in ./css, and an app’s Tailwind generates them from ./tailwind like every other class, so they need nothing else.
A nonce instead of the plugin
If your server writes a new random nonce into every response, you can give it to reka-ui instead of using the plugin. Put 'nonce-{value}' in style-src and pass the same value to reka-ui’s ConfigProvider around the app:
<ConfigProvider :nonce="nonce">
<App />
</ConfigProvider>
reka-ui then puts the nonce on every <style> it adds. Use it only with a nonce made fresh for each response. A static app served as files, as most Beehexa products are, cannot do that: use the plugin.
Server rendering
In an app rendered in the browser, Vue and reka-ui set inline styles through the DOM, and a policy does not limit that. An app rendered on the server writes the same styles into the HTML as style attributes, such as pointer-events on a Select value or overflow on a Scroll area. At the strict level the browser blocks every one under style-src-attr. The components are checked for apps rendered in the browser. If your app renders on the server and uses the strict level, render these components in the browser only, and check every page under the policy.
Not met yet
These components do not meet the strict style level yet. At the basic level they look right. Until they are fixed, don’t use them in a product at the strict level, or accept the result described.
| Component | What happens at the strict style level | Planned fix |
|---|---|---|
| Chart | ChartStyle writes a <style> element for every chart with its series colours for light and dark. The policy blocks it, and the browser logs a style-src-elem error. The series lose their colours: lines are not drawn and points turn black |
Set the colour variables on the chart with :style, and choose the dark colours with light-dark() or the theme attribute instead of a generated rule. Tracked in #39 |
| Input OTP | vue-input-otp 0.4.0 adds an empty <style id="input-otp-style"> when the first code field appears, then adds its rules to it from code. The policy blocks the element: the browser logs one style-src-elem error and the rules are lost. They make selected text and browser autofill invisible in the hidden input and adjust it on iOS. In desktop Chromium the field looks the same; autofill and iOS are not checked yet |
Ship the same rules in the package’s stylesheet, scoped to [data-input-otp], so the look does not depend on the library’s <style>. Tracked in #40 |
Don’t
- Don’t copy files out of the package or restyle its components with app CSS. Ask for the change in beehexa.design.
- Don’t take the same component from both
@beehexa/shadcn-vueand@beehexa/vue-componentsin one app.@beehexa/vue-componentskeeps Resizable panel, and Button and Tooltip for dashboard-v2 until it moves to this package.