Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Theme Picker Onboarding Block for Radix UI

Light, Dark and Auto in a segmented control over one drawn app window that wears the chosen scheme, with a 24-hour two-thumb bar for Auto and a preview-hour slider that decides what the window shows.

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 people try a colour scheme without touching the page with this theme picker for React with Radix UI. It is the appearance window of Hueholm, a writing app, in a fixed-height frame: the top bar names the screen and holds the one Shine Button, which reads Use Light, Use Dark or Use Auto; a segmented control picks the scheme; and one drawn app window (a rail, a draft and a word-count card) wears it. Auto opens a 24-hour bar with two thumbs, “Light from 07:00 to 19:00”, and a “Preview at 21:00” slider that decides which scheme the window wears at that hour. Only the drawn window is dressed; the status line says “Preview only. Your theme stays put.” Nothing is saved.

FAQ

How can the window show dark on a light page?

The window carries its own set of greyscale token values for each scheme (--background, --foreground, --card, --muted, --muted-foreground, --border), set as arbitrary properties on that one box. Everything inside is drawn with the usual token classes, so it reads those values and nothing else on the page changes. It does not use a dark class, so it cannot leak into the rest of the page. Showing a scheme is the feature, which is why it does not follow the site's theme.

How does Auto decide?

It compares the preview hour with the two thumbs: the window is light from the first thumb's hour up to (not including) the second's, and dark otherwise. The thumbs stay at least an hour apart. The 24-hour bar is always laid out left to right, even on a right-to-left page, because it is a clock, not a sentence.

Why are the Auto controls there when I pick Light or Dark?

They are in the layout either way, in the same cell as a one-line hint, with the unused layer invisible and inert. That way picking Auto never moves the window or the button. The hint says Auto follows the clock and tells you to pick it to set the hours.

How do the sliders work with a keyboard and a screen reader?

Both are ordinary sliders: Tab to a thumb and use the arrow keys, Home and End. The thumbs read in words (“Light starts at 07:00”, “Dark starts at 19:00”, “Preview at 21:00”) rather than a bare number, and the caption under the window repeats the result.

What stays local in the demo, and how do I wire it?

Use Auto only says the scheme was saved in this demo. In your app save the mode and the two hours to the account where apply says so, and apply the scheme with your theme provider. The window here is a picture and never changes the real theme.

How does it look on a phone?

The window keeps a fixed height; the preview shortens and the sliders take the full width. If the content is taller than the window, the middle region scrolls and takes keyboard focus, while the top bar and the status line stay in place.