# Installation

`@blocks/design-system` is one package: React components from a single import, design tokens as CSS and as typed data, an optional reset and optional Geist fonts.

## Supported versions

| Dependency | Version |
| --- | --- |
| React and React DOM | 19.3 (peer dependencies) |
| Next.js, if you use it | 16.4 (tested with 16.4.6) |
| Bun | 1.4 (the repository’s package manager; any npm-compatible client installs the package) |

## In a React app

Install the package with its peers. Until the first registry release, install the release-candidate tarball, whose SHA-256 is recorded with each release; the file name carries the version.

```sh
bun add @blocks/design-system react react-dom
# or, for a release candidate:
bun add ./blocks-design-system-0.0.0.tgz react react-dom
```

Import the stylesheet once in your root layout, before your own CSS. Add the reset and Geist if you want them; both are optional.

```tsx
// app/layout.tsx
import '@blocks/design-system/styles.css'
import '@blocks/design-system/fonts/geist.css' // optional: Geist and Geist Mono
import '@blocks/design-system/reset.css' // optional: global reset
```

Then import components from the package root. This page is a Server Component: it renders a static heading and an interactive Tabs from the same import, and forces a dark theme on its article with `data-ds-theme`.

**Example: A first page** (`examples/foundations/first-page.tsx`)

```tsx
// The installation guide's first page: a static heading and an interactive
// compound from the same import, in a Server Component, with a scoped theme.
import { Box, Heading, Tabs, TabsList, TabsPanel, TabsTab } from '@blocks/design-system'

export default function FirstPage() {
  return (
    <Box as="article" aria-labelledby="first-station" data-ds-theme="dark" padding="lg" backgroundColor="bg" color="text">
      <Heading as="h2" id="first-station">
        Station
      </Heading>
      <Tabs defaultValue="summary">
        <TabsList aria-label="Station views">
          <TabsTab value="summary">Summary</TabsTab>
          <TabsTab value="history">History</TabsTab>
        </TabsList>
        <TabsPanel value="summary">Current conditions</TabsPanel>
        <TabsPanel value="history">Past observations</TabsPanel>
      </Tabs>
    </Box>
  )
}
```

From a Server Component, import compound parts by name (`TabsList`); in a `'use client'` file you can also write `Tabs.List`. See [Composition](https://design-system.blocks-ui.com/foundations/composition.md).

## CSS only

Apps that only want the tokens import the smaller token stylesheet and read the `--ds-*` custom properties from their own CSS. No React is involved.

```css
@import '@blocks/design-system/tokens.css';

.card {
  padding: var(--ds-space-lg);
  color: var(--ds-color-text);
  background: var(--ds-color-bg-subtle);
  border-radius: var(--ds-border-radius-md);
}
```

## Build-time tokens

`@blocks/design-system/tokens` is plain JavaScript for build scripts: token values, `cssVarName`, and `renderTokensCss` for a stylesheet scoped to your own root. See [Themes](https://design-system.blocks-ui.com/foundations/themes.md).
