marclayuiv0.4.0
Guide

Theming

Two themes in one stylesheet, design tokens exposed as CSS variables, and react-bootstrap-style runtime color control through the provider.

Light & dark

The whole system hangs off one attribute: <html data-theme="dark">. The provider sets it for you and remembers the choice in localStorage under mcl-theme. Use the built-in toggle or the hook:

tsx
import { ThemeToggle, ThemeMenu, useTheme } from "marclayui";

// Drop-in pill button:
<ThemeToggle />

// Navbar menu with mode, style preset and color swatches:
<ThemeMenu />

// Or build your own from the hook:
const { mode, preference, setPreference, toggle } = useTheme();
setPreference("dark");     // force dark
setPreference("system");   // follow the OS
toggle();                  // flip light/dark

Style presets

A preset is a complete design language: it swaps the light and dark palettes together, plus shape and typography. Claymorphism (default) is warm terracotta clay with squircles and Quicksand; Neumorphism is soft grey-blue extrusion with a violet accent in light mode, a gold accent in dark mode, circles and Poppins/Manrope. Switching a preset also clears any custom runtime colors, so you always see the preset as designed.

tsx
import { MarclayProvider, PRESETS } from "marclayui";

// Pick a preset — it swaps the ENTIRE light + dark palette pair:
<MarclayProvider preset="neo">…</MarclayProvider>   // neumorphism
<MarclayProvider preset="clay">…</MarclayProvider>  // claymorphism (default)

// Or switch at runtime (persisted to localStorage):
const { preset, setPreset } = useTheme();
setPreset("neo");

// Under the hood it's just an attribute — pure CSS theming works too:
// <html data-preset="neo" data-theme="dark">

Runtime colors

Give setColors any subset of primary, secondary, accent, success, danger, warning, info, bg, ink, muted. MarclayUI derives everything else — lighter gradient stops, readable ink, clay inner glows, focus rings and even the shadow colors when you change the background.

tsx
import { useTheme } from "marclayui";

const { setColors, resetColors } = useTheme();

// One call repaints gradients, clay glows, focus rings
// and readable text colors across every component:
setColors({ primary: "#7c5cff", bg: "#ece7f6" });

resetColors(); // back to the stylesheet defaults
tsx
// Static colors for the whole app:
<MarclayProvider
  defaultMode="dark"
  colors={{ primary: "#4a90d9", secondary: "#7fb5c9" }}
>
  <App />
</MarclayProvider>

Design tokens

Every color, shadow and radius is a CSS custom property, so pure-CSS theming works too — handy for marketing sites or white-label builds:

tsx
/* Or theme purely in CSS — override the tokens on :root */
:root {
  --mcl-primary: #7c5cff;
  --mcl-bg: #ece7f6;
}
[data-theme="dark"] {
  --mcl-primary: #9d85ff;
  --mcl-bg: #221e2e;
}
TokenPurpose
--mcl-bgApp background — the surface every shadow is carved from
--mcl-inkPrimary text color
--mcl-mutedSecondary text color
--mcl-primary / -2 / -inkBrand tone, its lighter gradient stop, and text on it
--mcl-{tone}-deepDarkened tone for colored text on the page background (soft badges, stat values) — auto-derived at runtime too
--mcl-secondary / -2 / -inkSupporting tone (sage by default)
--mcl-accent / -2 / -inkHighlight tone (gold by default)
--mcl-success | danger | warning | infoStatus tones, each with -2 and -ink variants
--mcl-sd / --mcl-slDark & light shadow colors — the neumorphic light source
--mcl-out / -sm / -xsRaised (extruded) shadow stack
--mcl-in / -sm / -xsPressed (inset well) shadow stack
--mcl-clay-p … -iColored inner-light shadows, one per tone
--mcl-ringFocus ring color
--mcl-radius / -sm / -lgCorner radii (presets ship different shapes)
--mcl-avatar-radius / --mcl-navbar-radiusSquircle vs circle avatars, pill vs rounded navbar
--mcl-font / --mcl-monoFont stacks (clay: Quicksand · neo: Poppins/Manrope)
ScrollbarsThemed automatically: .mcl-root styles the page scrollbar, .mcl-scroll styles any scrollable container

Live playground

Everything below is live: swap the style preset and mode, drag the color pickers, squeeze the corner radius and change the typeface — the whole page re-themes in real time. The generated JSX shows exactly what your app needs.

STYLE PRESET
Warm terracotta clay, squircles, Quicksand — the signature MarclayUI look.
MODE · LIGHT
COLORS
primary
#e0785a
secondary
#a8b894
accent
#d9a854
muted text
#97897b
background
#ece4da
text
#4a3f35
SHAPE & TYPE
Typeface
PALETTES
Live
Playground66%

Equivalent JSX

<MarclayProvider
/>

Provider API

PropTypeDefaultDescription
preset"clay" | "neo""clay"Style preset; swaps the light+dark palette pair, radii and fonts. Persisted to localStorage.
setPreset(p)(p: PresetName) => void—Switch preset at runtime; clears custom color overrides so the preset shows cleanly.
defaultMode"light" | "dark" | "system""system"Starting mode; persisted to localStorage after the first change.
colorsColorOverrides—Initial runtime color overrides applied on mount.
useTheme().mode"light" | "dark"—Resolved mode after 'system' is applied.
useTheme().preference"light" | "dark" | "system"—What the user picked.
useTheme().setColors(colors)(c: ColorOverrides) => void—Merge new overrides; derived shades update instantly.
useTheme().resetColors()() => void—Remove all overrides, back to preset defaults.