Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Theme Editor Settings Block for React

A theme editor window: five colour tokens each with a picker, a hex field and a contrast ratio worked out from the hex values, a radius slider and a font select, a Light or Dark set with Dark derived until edited, a drawn sign-up page that wears the tokens and a Copy CSS button.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Let a site's owner restyle it and see the page answer, with this theme editor for React with Base UI. It's an app window with a top bar that holds a Toggle Group to choose the Light or Dark set being edited and a Shine Button, Copy CSS. At the start sit five colour tokens, Background, Foreground, Primary, Muted and Border, each with the catalog Color Picker next to a hex field, and under it the contrast of that token against the colour it is read on, worked out from the two hex values ("Text on it: 14.7 to 1, passes AAA"), then a Slider for the corner radius and a Native Select for the font. At the end, and under the colours on a phone, a drawn sign-up page for a bakery wears the tokens through custom properties set on that drawing only, with the CSS the clipboard would get shown under it. The Dark set is derived from Light until you change one of its colours, and says so. It's built from Color Picker, Input Group, Slider, Native Select, Toggle Group, Shine Button and Guides, with a CSS entrance only. For a website or app builder, a design system admin or a white-label setting.

FAQ

How do I use my own tokens?

Edit LIGHT, the five hex values (digits only, without the hash, so no colour literal sits in the source) the Light set starts from, and TOKENS, FONTS and the starting radius and font below it. Everything else is worked out from them: the Dark set, the contrast lines, the drawing and the CSS text. To add a token, add it to Tokens, TOKENS and the checkOf function that says what it is read against.

How is the contrast worked out?

With the WCAG formula: each colour's relative luminance from its hex value, then (lighter plus 0.05) over (darker plus 0.05). The ratio is cut down to a tenth, so a near miss never reads as a pass. Background is read against Foreground, Foreground against Muted, Primary against the better of the two inks (the button's label), and Border against Background; text needs 4.5 to 1 for AA and 7 to 1 for AAA, a field's edge 3 to 1. Muted has no minimum, it is a quiet panel. A filled dot means it passes, a hollow one that it does not, and the words say the same.

How is the Dark set derived, and how do I override it?

From the Light set: Foreground and Background trade places, Muted and Border are mixes of the two, and Primary is lightened toward white. Switch the toggle to Dark, edit any colour there, and that colour is marked Edited instead of Derived and stops following Light. The Use derived button in that set's heading puts every colour back to what Light derives; in the Light set the same button says Reset and puts the colours back to the starting values.

What does Copy CSS copy, and what stays local?

The text shown under the drawing: a :root block with the five Light colours, the radius in rem and the font stack, and a .dark block with the five Dark colours. It goes to the clipboard, which needs a secure page; if the browser refuses, the status line says so and the CSS is a focusable region you can select from. Nothing is saved or sent: reloading starts from the starting values.

How do the picker and the hex field work together?

They stay in step. Drag in the picker and the field shows the hex; type six hex digits, with or without the hash, and the picker and the drawing follow at once. While what you have typed is not six digits the field says so and the last good colour stays in use, and leaving the field puts that colour back in it. The digits read left to right in any language.

Is it accessible, and how does it look on a phone?

Each token has a visible label tied to its hex field, a named button that opens its picker, and a contrast line that the field points to as its description. The drawn page is decorative and its caption says which set, radius and font it shows, and the status line is a polite live region that is present from the start. On a phone the window keeps its height and scrolls inside: the tokens first, the preview under them.

  • Pro

    Appearance Settings

    Appearance and locale

    An appearance settings panel that previews instead of applying: a drawn app window that wears the choices, theme and contrast cards with a drawn thumbnail each, a text-size slider with a sample sentence and a reduce motion switch with a replay.

  • Pro

    Brand Colour Picker Form

    Numbers and pickers

    A brand colour field that makes a scale: a hex input and the colour picker kept in sync, eight named presets, and five derived steps by lightness, each with its hex and a copy button.

  • Pro

    Brand Asset Settings

    Appearance and locale

    A logo check panel: Paper and Ink tiles showing a drawn lettermark at true size with its clear space in hairlines and its contrast worked out from the hex values, a Full, Mark or Mono toggle, a size slider that warns below 24 px, and a four-colour palette with Copy.

  • Pro

    Four drawn logo lockups in framed cells with a Show clear space toggle that lays the margin over every lockup, and real SVG and PNG downloads under each.

  • Pro

    Sidebar Layout Settings

    Appearance and locale

    A navigation editor in a window beside the app it edits: a layout chosen from three cards with drawn thumbnails, a collapse mode, five items with visibility toggles and Move up and down, Settings that cannot be hidden, and a drawn app that redraws on every change.

  • Pro

    A theme pill for a writing app: a three-way toggle group (Light, System, Dark) seeded from the page's theme, with a label that says which one is on.