Layout, Tailwind and helpers
Layout, spacing and responsive behaviour come from Tailwind. Sidedish adds colour tokens and a few JavaScript helpers.
How it helpsTailwind CSS v4 is a peer dependency. Sidedish lives in Tailwind layers, so your utilities always win, and its colours are Tailwind colours:
bg-accent, text-muted, border-line, bg-tint, text-good. Use sm:, md: and lg: for responsive layouts, and dark: follows the theme toggle.Tailwind layout with Sidedish colours
1 column on phones
3 from
sm upbg-accent text-on
export default function Example() {
return (
<>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3 w-full">
<div className="rounded-sm border border-line bg-surface p-4 text-sm text-sub">1 column on phones</div>
<div className="rounded-sm border border-line bg-surface p-4 text-sm text-sub">3 from <code>sm</code> up</div>
<div className="rounded-sm bg-accent p-4 text-sm text-on">bg-accent text-on</div>
</div>
</>
);
}<div class="grid grid-cols-1 gap-3 sm:grid-cols-3 w-full">
<div class="rounded-sm border border-line bg-surface p-4 text-sm text-sub">1 column on phones</div>
<div class="rounded-sm border border-line bg-surface p-4 text-sm text-sub">3 from <code>sm</code> up</div>
<div class="rounded-sm bg-accent p-4 text-sm text-on">bg-accent text-on</div>
</div>In Next.js
// Theme from the server, with no flash: app/layout.tsx
<Sidedish theme={{ accent: "#7c3aed", bg: "#ffffff" }} />
// Theme at runtime, from a client component:
import { theme, toast, useSidedishEvent } from "sidedish";
theme({ accent: "#b4532a" }); // whole page
theme({ accent: "#b4532a" }, element); // one subtree
toast("Hello");API
| Name | Type | Description |
|---|---|---|
bg-* text-* border-* | Tailwind colours | bg, surface, ink, sub, muted, line, tint, accent, on, good, bad, warn, info. |
font-sans / font-mono | Tailwind fonts | DM Sans and Red Hat Mono. |
.tone .surface | class | Colour text by tone / white bordered box. |
.table-wrap | class | Bordered, scrollable table wrapper. |
<Sidedish theme={…} /> | component | Mount once in the root layout. Optional theme tokens, rendered on the server. |
theme(vars, scope?) | function | Set --sd-* tokens at runtime. |
useSidedishEvent(ref, name, fn) | hook | Listen to select / change / files on a web component. |