When a designer changes the border colour of cards, every product should follow without a single line of product code changing. That works when products read their values from the token package instead of copying them. This page shows how to set that up and how to build on it.
Import the token CSS once, then use a role token for every colour, size, space, radius, shadow and duration.
Install the packages
The design system ships as seven npm packages, built from the beehexa.design repository. Install the ones your product needs:
| Package | What it holds | Needs |
|---|---|---|
@beehexa/design-tokens |
Every token as CSS custom properties, as typed JavaScript, and as DTCG files | Nothing else |
@beehexa/design-rules |
The guidance on this site, packaged for tools and AI agents | Nothing else |
@beehexa/ant-design-vue-tokens |
The tokens as an Ant Design Vue theme. See Ant Design Vue theme | ant-design-vue 4.2.6 or later 4.x, vue 3.3 or later |
@beehexa/mermaid-tokens |
The tokens as a Mermaid configuration. See Mermaid | mermaid 12 |
@beehexa/vueflow-tokens |
The tokens as a VueFlow theme. See VueFlow | @vue-flow/core, controls and minimap 1.x, vue 3 |
@beehexa/vue-components |
Vue components, starting with Resizable panel | vue 3.5 or later |
@beehexa/shadcn-vue |
Every shadcn-vue component on Beehexa tokens. See shadcn-vue package. Not on npm yet: its first release needs manager setup | vue 3.5 or later, reka-ui 2.11 or later; Tailwind CSS v4 only if the app builds the styles itself |
The adapter packages read the token package; they don’t copy its values.
npm install @beehexa/design-tokens@<version> @beehexa/design-rules@<version>
- Install the same version of every Beehexa package. All seven are released together under one version number,
YYMM.DD.N: the date of the release and its number that day. A package from another release may not match the token values. - Pin the exact version and update it on purpose. Read
CHANGELOG.mdin the repository before you update: a token can be renamed or removed. - Use a version only once it has been published. Releases are published only with manager approval, so never guess a version number.
- Don’t copy the generated files into your product. A copy stops following the system the day it is made.
Trying a change before it is released
To test an unreleased change, build the packages in a checkout of the repository and point your product at them on your machine only:
npm ci
npm run build:packages
{
"dependencies": {
"@beehexa/design-tokens": "portal:../beehexa.design/packages/design-tokens"
}
}
Keep this on your machine. CI installs published versions only, and never builds a sibling repository.
Add the tokens
Import the CSS once, in your app’s entry point:
import '@beehexa/design-tokens/css';
Then use the tokens in your styles:
.panel {
padding: var(--bh-space-card);
border: var(--bh-border-width-default) solid var(--bh-color-border);
border-radius: var(--bh-radius-card);
color: var(--bh-color-text);
}
When code needs a value rather than CSS, such as a chart library, read it from JavaScript:
import { tokens, tokenInfo } from '@beehexa/design-tokens';
const text = tokens.light['color.text'];
const darkText = tokens.dark['color.text'] ?? text;
The token sizes are in rem, so text and spacing grow with the person’s browser font size. If your app sets a root font size other than 16 px, import @beehexa/design-tokens/css/pixels instead of, not as well as, the default CSS.
Dark mode and Vietnamese
The same CSS handles both. You don’t change any token names.
- Dark mode follows the person’s system setting. To set it yourself, put
data-theme="dark"ordata-theme="light"on the root element. See Dark mode. - Vietnamese text gets taller line heights so its marks are not clipped. Set
lang="vi"on the root element, or on any element that holds Vietnamese text.
Build components
Build each control to match its page in Components: the same structure, states, tokens and keyboard behaviour. A component page in an early release phase describes the direction, not final values: don’t fill gaps with values of your own. Ask the design system team instead.
Check before you ship
- Does every value come from a token, with no hex colours, pixel sizes or durations typed by hand?
- Can every control be reached and used with a keyboard, with a visible focus ring? See Keyboard and focus.
- Does the screen pass the checks in Accessibility testing, in light and dark?
- Does it work at 320 px wide, and with
lang="vi"?
Working with AI agents
Point your agent at @beehexa/design-rules/agent first. It then reads the full rules offline with the package’s listRules, readRule and searchRules. A rule marked as planned is not permission to invent values. The site’s /llms.txt is an index for browsing, not a replacement for the installed rules. See Docs for AI agents.
Related
- Tokens overview: how tokens are named and layered.
- All design tokens: every token and its value.
- Tools: lint rules for styles and templates.