The Elhub Design System is a comprehensive design system that provides reusable components, design tokens, and guidelines for building consistent, accessible, and high-quality user interfaces across all Elhub applications.
This design system serves several key objectives:
- Consistency - Ensure a unified user experience across all Elhub platforms and services, making it easier for users to navigate and interact with different parts of the Elhub ecosystem.
- Accessibility - Build inclusive interfaces that meet WCAG standards and serve all users, including those with disabilities, ensuring equal access to energy data and services.
- Quality - Maintain high standards for code quality, design excellence, and user experience through shared components and best practices.
- Efficiency - Accelerate development by providing ready-to-use, well-tested components that reduce duplication of effort across teams.
- Collaboration - Foster collaboration between designers, developers, and stakeholders through shared language and resources.
- Transparency - As a public sector entity in Norway, Elhub embraces open source principles to promote transparency, enable community contributions, and support the broader public sector digital transformation.
By open sourcing this design system, Elhub contributes to the Norwegian public sector's collective efforts to improve digital services, encourages code reuse across government entities, and invites community scrutiny and contributions to continuously improve the quality and accessibility of our user interfaces.
If you want to improve the design system, clone this repository and follow the development instructions below.
If you want to use the design system in your project, currently you need to clone the repository from GitHub, build it locally, and include the packages in your project. Eventually, these packages will be published to npm under the @elhub organization, allowing you to install them directly using npm or yarn.
This repository is a monorepo scoped as @elhub, and contains the following npm workspaces:
| Workspace | Description | Published Package |
|---|---|---|
| ds-components | React component library with 25+ UI components | @elhub/ds-components |
| ds-css | CSS component styles using BEM methodology | @elhub/ds-css |
| ds-tokens | Design tokens (colors, typography, spacing) | @elhub/ds-tokens |
| ds-icons | SVG icon components extracted from Figma | @elhub/ds-icons |
| ds-graph | Graph visualization components | @elhub/ds-graph |
| ds-www | Documentation website | - |
Currently, to use the design system in your project, you need to:
- Clone this repository:
git clone https://github.com/elhub/user-interface-design-system.git
cd user-interface-design-system- Install dependencies and build:
npm run install:all
npm run build- Link the packages to your project or reference them directly.
Coming soon: Packages will be published to npm under the @elhub organization, allowing direct installation via:
npm install @elhub/ds-components @elhub/ds-cssTo use the design system components, you must install these core dependencies:
Required packages:
@elhub/ds-components- React component library@elhub/ds-css- Component styles
Optional packages:
@elhub/ds-graph- Graph visualization components@elhub/ds-icons- Icon component collection
Peer dependencies (must be installed in your project):
react(^18.0.0)react-dom(^18.0.0)lodash(^4.17.21)styled-components(^6.0.0)
import { Button, Card, Typography } from '@elhub/ds-components';
import '@elhub/ds-css/dist/index.css';
function App() {
return (
<Card>
<Typography variant="h1">Welcome to Elhub</Typography>
<Button variant="primary" onClick={() => console.log('Clicked!')}>
Get Started
</Button>
</Card>
);
}The design system requires CSS to be imported in your application:
// In your main application file (e.g., index.tsx or App.tsx)
import '@elhub/ds-css/dist/index.css';Note: Design tokens are bundled into @elhub/ds-css, so you don't need to import @elhub/ds-tokens separately.
Design tokens (colors, typography, spacing, etc.) are automatically available as CSS custom properties when you import @elhub/ds-css.
If you need to access tokens in other formats for build tools or JavaScript:
// SCSS
@import '@elhub/ds-tokens/dist/tokens.scss';
// JavaScript/TypeScript
import tokens from '@elhub/ds-tokens/dist/tokens.json';import { IconChevronDown, IconSearch } from '@elhub/ds-icons';
function MyComponent() {
return (
<div>
<IconSearch aria-label="Search" />
<IconChevronDown />
</div>
);
}For detailed component APIs, props, and usage examples, visit the documentation site:
npm run ds-www:startThis will start a local development server at http://localhost:4444 with comprehensive documentation,
interactive examples, and API references for all components.
- Node.js: Version 18 or higher
- npm: Version 9 or higher
Verify your installation:
node -v # Should output v18.x.x or higher
npm -v # Should output 9.x.x or higher- Clone the repository:
git clone https://github.com/elhub/user-interface-design-system.git
cd user-interface-design-system- Install all dependencies:
npm run install:allThis installs dependencies for the root workspace and all child workspaces.
- Build all workspaces:
npm run buildThis builds all workspaces in the correct dependency order (tokens → css → components).
Start the documentation site (recommended for development):
npm run ds-www:startStart the graph components demo:
npm run ds-graph:start- Make changes to component files in
ds-components/src/components/ - Changes will hot-reload if using the dev server
- Build the workspace to see changes in dependent projects:
npm run ds-components:build- Edit CSS files in
ds-css/src/components/ - Build the CSS workspace:
npm run ds-css:build- Edit token source files in
ds-tokens/src/ - Build tokens (must be done before building other workspaces):
npm run ds-tokens:build- Rebuild CSS and components to reflect token changes:
npm run ds-css:build
npm run ds-components:buildnpm run lint # Check for linting errors
npm run lint:fix # Auto-fix linting errorsnpm run prettier # Check code formatting
npm run prettier:fix # Auto-format codenpm run typecheck # Run TypeScript type checksnpm run test # Run tests in watch mode
npm run test:ci # Run tests once (CI mode)npm run checktidy # Run lint, prettier, typecheck, and tests
npm run tidy # Auto-fix lint and prettier issues, then typecheckds-www, ds-components, ds-graph → ds-css → ds-tokens
ds-components → ds-icons
Important: When making changes to ds-tokens, you must rebuild downstream packages (css, components) to see the changes.
- Components follow barrel export pattern (see
ds-components/src/dist.ts) - Each component uses
forwardReffor ref forwarding - Class names use BEM methodology with
eds-prefix - Styling via CSS classes composed with
clsxutility - No inline styles or CSS-in-JS (use
ds-cssworkspace)
- Vite for bundling (components, www, graph)
- TypeScript for type safety
- PostCSS for CSS processing
- Style Dictionary for token generation
- Changesets for version management and publishing
This project uses Changesets for version management.
- Make your changes to the codebase
- Create a changeset:
npm run changeset- Follow the CLI prompts to describe your changes
- Commit the generated changeset file
To bump versions based on changesets:
npm run changeset:versionPublishing is typically handled by CI/CD (TeamCity), but can be done manually:
npm run prerelease # Prepare for release
npm run publish # Publish to registryWarning: Only run this if you understand the implications.
npm run update # Update all package.json files with latest dependency versionsnpm run knip- Check for unused dependenciesnpm run clean- Remove all build artifacts and node_modules
| Category | Technology |
|---|---|
| Language | TypeScript 5.x |
| Framework | React 18.x |
| Build Tool | Vite 5.x |
| Styling | CSS Modules, PostCSS |
| Tokens | Style Dictionary |
| Testing | Vitest |
| Linting | ESLint (Flat Config) |
| Formatting | Prettier |
| Version Control | Git, GitHub |
| CI/CD | TeamCity |
| Package Manager | npm (workspaces) |
The design system supports modern browsers:
- Chrome (last 2 versions)
- Firefox (last 2 versions)
- Safari (last 2 versions)
- Edge (last 2 versions)
All components are built with accessibility in mind:
- WCAG 2.1 Level AA compliance
- Keyboard navigation support
- Screen reader compatible
- ARIA attributes where appropriate
- Uses Radix UI primitives for accessible component foundations
- Grid, Container, Spacing utilities
- Button, Input, Select, Checkbox, Radio, DatePicker, Dropdown
- Card, Badge, Tag, Chip, Alert, Tooltip, Popover, Modal
- Navbar, Tabs, Pagination, Link
- Table, Graph (visualization)
- Typography, Divider, Loader, Icon
Tokens are organized into the following categories:
- Colors: Semantic color tokens (primary, secondary, status colors)
- Typography: Font families, sizes, weights, line heights
- Spacing: Consistent spacing scale (4px base grid)
- Border: Border radius, widths
- Shadows: Elevation system
- Z-index: Layering system
Tokens are generated in multiple formats:
- CSS Custom Properties (
tokens.css) - SCSS Variables (
tokens.scss) - JSON (
tokens.json) - Less Variables (
tokens.less)
Contributing, issues and feature requests are welcome. See the Contributing file.
This project is developed by Elhub. For the specific development group responsible for this code, see the Codeowners file.
This project is published under the MIT license.
The codebase for ds-tokens, ds-css, and ds-components extends Nav's codebase from github.com/navikt/aksel / aksel.nav.no, also published under the MIT license.
The codebase for ds-graph depends on highcharts/highcharts, which is source available. Production and commercial use require a commercial license. See shop.highcharts.com for more information.
We stand on the shoulders of giants! This design system is built on the work of
many open source projects and libraries. Check them out in the package[-lock].json
files of each workspace for a full list of dependencies.
We would like to mention each and every one of them, but that would be a very long list. Here we only mention the projects that have licenses that explicitly require attribution. This does not mean that the other projects are not worth mentioning!
- we have a transitive dependency on browserslist/caniuse-lite from caniuse.com.