Skip to content
Skip to content

Get started

Getting started

Tessera runs in any React 18 or 19 app. This guide takes about ten minutes, from installing the package to switching your app to dark mode.

Install

Add the package and its one peer dependency.

Terminal
npm install @tessera/react @tessera/tokens

Add the provider

The provider loads the tokens and tells components which colour scheme to use. Put it at the root of your app.

app/layout.tsx
import { TesseraProvider } from "@tessera/react";
import "@tessera/tokens/tokens.css";

export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <body>
                <TesseraProvider>{children}</TesseraProvider>
            </body>
        </html>
    );
}

Your first component

Components are named exports. Each one accepts the native attributes of the element it renders.

app/page.tsx
import { Button } from "@tessera/react";

export default function Page() {
    return <Button variant="primary">Create project</Button>;
}

Theming

Colours are named by purpose, not by hue: surface, muted and primary. Override a token once and every component that uses it follows.

styles/brand.css
:root {
    --tessera-primary: 79 70 229;
    --tessera-radius-control: 8px;
}

Keep contrast in mind
When you change a colour token, check text on it still reaches 4.5:1. The token pairs in Tessera ship at that level.

Dark mode

Add the dark class to the root element, or to any container to show one part of a page in dark mode. Components read the same tokens either way, so nothing else changes.

Dark container
<section className="dark">
    <Button variant="primary">Shown in dark mode</Button>
</section>