InstallComponentsExample

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 up
bg-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

NameTypeDescription
bg-* text-* border-*Tailwind coloursbg, surface, ink, sub, muted, line, tint, accent, on, good, bad, warn, info.
font-sans / font-monoTailwind fontsDM Sans and Red Hat Mono.
.tone .surfaceclassColour text by tone / white bordered box.
.table-wrapclassBordered, scrollable table wrapper.
&lt;Sidedish theme={…} /&gt;componentMount once in the root layout. Optional theme tokens, rendered on the server.
theme(vars, scope?)functionSet --sd-* tokens at runtime.
useSidedishEvent(ref, name, fn)hookListen to select / change / files on a web component.