@hpe-web/design-tokens
v1.1.0
Published
HPE Design System — design tokens (CSS, JSON)
Readme
@hpe-web/design-tokens
HPE Design System design tokens — CSS custom properties, DTCG source, locale overrides, and utilities.
What's new in v1.1.0
button.anchorrenamed tobutton.link- New
button.carouselvariant (disabled, hover, rest states) - New
button.playvariant - Added font families: M Hei PRC, Noto Sans CJKJP, YD Gothic, HPE Graphik XXCondensed
- New
dimensiontokens across all viewports
Install
npm install @hpe-web/design-tokensUsage
CSS (recommended)
Load the base file and any overrides your app needs. The cascade handles viewport, theme, and locale simultaneously.
<!-- Required -->
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/tokens.css">
<!-- Optional -->
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/tokens.dark.css">
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/tokens.md-lg.css">
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/tokens.xl.css">
<!-- Locales (if your app serves multiple languages) -->
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/locales/de.tokens.css">
<link rel="stylesheet" href="node_modules/@hpe-web/design-tokens/css/fonts/de.fonts.css">| File | Contents | Applied when |
|------|----------|-------------|
| tokens.css | All tokens — sm-xs base, light theme | Always |
| tokens.dark.css | Dark theme color overrides | [data-theme="dark"] |
| tokens.md-lg.css | Typography + border-radius overrides | @media (min-width: 992px) |
| tokens.xl.css | Typography + border-radius overrides | @media (min-width: 1600px) |
| locales/{lang}.tokens.css | Font-size + font-family overrides | [lang="xx"] |
| fonts/{lang}.css | @font-face declarations | Always (locale-specific) |
Then use tokens in your CSS:
.card {
background: var(--hpe-web-color-background-card);
padding: var(--hpe-web-space-medium);
border-radius: var(--hpe-web-border-radius-medium);
font-size: var(--hpe-web-text-medium-font-size);
}No breakpoint logic needed in component CSS. Token values shift automatically as viewport, theme, and lang attributes change.
Dark mode:
<body data-theme="dark">…</body>Locale switching:
<html lang="de">…</html>Static metadata
All three metadata files live in static/:
import breakpoints from '@hpe-web/design-tokens/static/breakpoints.json' assert { type: 'json' };
// { values: { xs: '0px', md: '992px', xl: '1600px' },
// ranges: { 'md-lg': { mediaQuery: '(min-width: 992px)' }, ... } }
import locales from '@hpe-web/design-tokens/static/locales.json' assert { type: 'json' };
// locales.de.coefficient.display === 0.75
// locales.ja.minFontSize === '14px'
import fonts from '@hpe-web/design-tokens/static/fonts.json' assert { type: 'json' };breakpoints.json is generated from DTCG token values at build time. fonts.json and locales.json are hand-maintained. All three are for tooling and pipeline scripts — the browser gets everything it needs from the CSS files.
Bring your own Style Dictionary
For custom output formats (AEM, native, SCSS), run your own SD pipeline against our DTCG source:
import StyleDictionary from 'style-dictionary';
import { lineHeightUnitless, letterSpacingEm } from '@hpe-web/design-tokens/transforms';
const sd = new StyleDictionary({
source: [
'node_modules/@hpe-web/design-tokens/dtcg/foundation/**/*.tokens.json',
'node_modules/@hpe-web/design-tokens/dtcg/semantic/**/*.tokens.json',
'node_modules/@hpe-web/design-tokens/dtcg/theme/light/**/*.tokens.json',
'node_modules/@hpe-web/design-tokens/dtcg/viewport/sm-xs/**/*.tokens.json',
],
platforms: { /* your config */ },
});
sd.registerTransform(lineHeightUnitless); // px line-height → unitless ratio
sd.registerTransform(letterSpacingEm); // px letter-spacing → em
await sd.buildAllPlatforms();See dtcg/hpe.resolver.json for the canonical token load order.
Locale metadata for custom pipelines:
import locales from '@hpe-web/design-tokens/static/locales.json' assert { type: 'json' };
// locales.de.coefficient.display === 0.75
// locales.ja.minFontSize === '14px'Package Contents
| Export | What |
|--------|------|
| @hpe-web/design-tokens/css/* | CSS custom properties (primary format) |
| @hpe-web/design-tokens/static/* | System metadata — breakpoints.json, locales.json, fonts.json |
| @hpe-web/design-tokens/dtcg/* | DTCG 2025.10 source (for custom pipelines) |
| @hpe-web/design-tokens/transforms | SD transforms + applyLocale utility |
License
Proprietary — Hewlett Packard Enterprise
