InstallComponentsExample

Theming

Colours are props. Sidedish reads every colour from a CSS variable, so you can change one button, one section or the whole site.

Per component: tone

Use data-tone for presets, or set --tone to any colour you like.

clay badge
export default function Example() {
  return (
    <>
      <button data-tone="good">good</button>
      <button data-tone="warn">warn</button>
      <button data-tone="bad">bad</button>
      <button data-tone="ink">ink</button>
      <button style={{ "--tone": "#7c3aed" }}>--tone:#7c3aed</button>
      <span className="badge" style={{ "--tone": "#b4532a" }}>clay badge</span>
      <progress value="60" max="100" style={{ "--tone": "#7c3aed", width: "160px" }}></progress>
    </>
  );
}
<button data-tone="good">good</button>
<button data-tone="warn">warn</button>
<button data-tone="bad">bad</button>
<button data-tone="ink">ink</button>
<button style="--tone:#7c3aed">--tone:#7c3aed</button>
<span class="badge" style="--tone:#b4532a">clay badge</span>
<progress value="60" max="100" style="--tone:#7c3aed;width:160px"></progress>

Per section

--tone is inherited, so setting it on a wrapper recolours everything inside.

Blue
export default function Example() {
  return (
    <>
      <div className="flex flex-wrap items-center gap-3" style={{ "--tone": "#3b6fd4" }}>
        <button>Blue</button><span className="badge">Blue</span><input type="checkbox" role="switch" defaultChecked />
      </div>
    </>
  );
}
<div class="flex flex-wrap items-center gap-3" style="--tone:#3b6fd4">
  <button>Blue</button><span class="badge">Blue</span><input type="checkbox" role="switch" checked>
</div>

Global: live playground

Pick colours below and the whole site updates through theme(). To set it from the server, pass <Sidedish theme={{ accent: "#7c3aed" }} /> in your layout.

// app/layout.tsx: rendered on the server, no flash
<Sidedish theme={{ accent: "#7c3aed", bg: "#ffffff" }} />

// or at runtime in a client component
import { theme } from "sidedish";
theme({ accent: "#7c3aed" });

Tokens

:root {
  --sd-accent: #d08873;   /* terracotta */
  --sd-bg: #fdfcf9;       /* warm off-white */
  --sd-surface: #ffffff;  /* white */
  --sd-ink: #1a1a1a;      /* near-black */
  --sd-r: 2px;            /* corner radius */
  --sd-font: "DM Sans", system-ui, sans-serif;
}
TokenDefaultUsed for
--sd-accent#d08873Terracotta: buttons, highlights
--sd-bg#fdfcf9Warm off-white page background
--sd-surface#ffffffCards, inputs, dialogs
--sd-ink#1a1a1aNear-black text
--sd-sub#443c35Body text
--sd-muted#6b5e52Labels
--sd-line#eeebe7Borders, idle chart bars
--sd-tint#f7f2eeMuted surfaces, tab tracks
--sd-good#1f8a5bSuccess tone
--sd-warn#b57b08Warning tone
--sd-bad#c4213fDanger tone
--sd-info#3b6fd4Info tone

Dark mode

<html lang="en" data-theme="dark">

Use the moon button in the header to see it.