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.
npm install @tessera/react @tessera/tokensAdd the provider
The provider loads the tokens and tells components which colour scheme to use. Put it at the root of your app.
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.
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.
:root {
--tessera-primary: 79 70 229;
--tessera-radius-control: 8px;
}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.
<section className="dark">
<Button variant="primary">Shown in dark mode</Button>
</section>