Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Design Tokens Command Menu Block for React

A design-system inspector's token picker as a command menu hung from a Fill field: tokens in groups with their resolved values and a small drawing, a box pane that wears whatever you apply, the alias chain of the last token, and a copy as CSS variable or JSON.

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

Try a token on a real box before you commit to it with this design tokens command menu for React with Base UI. It opens from the Inspector of Tokenhollow, a design-system inspector, whose header holds an outline field with its ⌘ K cap, and the inspector is drawn under a soft scrim inside a hairline frame with a plus mark on each corner: a column of fields with Fill at its top, and a box in the middle. The menu hangs from the Fill field and is the catalog Command. Tokens come in five groups, Neutral from 50 to 950, Space, Radius, Shadow and Type, each with its resolved value ("L 96%", "16 px") and a small drawing of it in greys: a swatch, a bar, a corner, a shadow, the letters Aa. Choosing a token applies it to the box in the pane under the list, by the group it is from: the fill, the padding, the corner radius, the shadow or the type size. The pane lists what the box now uses, shows the alias chain of the token you applied last (button.bg, then surface.raised, then neutral.100), and two chips choose whether the Copy button copies it as a CSS variable or as JSON. The menu stays open so you can watch the box; Escape closes it. Nothing on the page changes theme: the tokens belong to the inspected system. For preview the menu is drawn open in place when the page loads; the field, or Ctrl or ⌘ K while focus is in the block, opens the real command dialog with the same box and query. For design-system tools, theme editors and any product that lets people pick from a token scale.

FAQ

Why is the menu already open, and what do I keep?

So you can see it without a click. On load the menu is the Command and its box pane drawn inline under a picture of the inspector, in a plain shell that is not modal, so nothing is trapped, hidden or focused and the page around the preview keeps working. The header's field opens the real command dialog, modal, with its focus trap, Escape and focus return, and the inline copy stays closed until a reload. Both show the same Palette and share the block's state, so the box you built in the copy is the box the dialog opens with. In your app keep the dialog and drop the copy: the "in-place" state, the scrim with its shell and the Escape and blur effects.

What does choosing a token change?

Only the property its group sets. A neutral token sets the fill, a space token the padding, a radius token the corner, a shadow token the shadow and a type token the size of the letters; the other four stay as they were. The box is drawn with the classes each token carries, the five facts beside it and the Fill field in the drawing read the same state, and the status line says what was applied. A tick and the words ", applied" mark the token in use in each group.

What is the alias chain?

Each group is reached through the same semantic tokens: the box's fill is button.bg, which points at surface.raised, which points at the neutral you picked. The pane shows that chain for the token applied last, so you see which names a change would travel through. The chains are typed with the groups; in your app they come from your token files.

What does Copy copy?

The token applied last, in the format you chose: a CSS variable (--neutral-100: 96%;) or JSON ({ "neutral-100": "96%" }), through the clipboard. The line under the chips shows exactly the text that will be copied, and the status line says what was copied or that the browser refused. The values are the demo system's own; the shadow ones use a made-up --ink-12 variable, so replace them with yours.

What stays local, and how do I wire it?

All of it. The tokens, their values and the box are typed, nothing is saved and the page's theme never changes: the swatches are mixes of the theme's own text and page colours, so they stay grey in every theme. In your app build TOKENS from your design-token files, keep a class or a style for each so the box can wear it, and make pick write the token to the selected layer.

Is it accessible from the keyboard?

Yes. Type to search by name, value or word ("radius", "16", "shadow"), the arrow keys move through the tokens, Enter applies the highlighted one and keeps focus in the input, and Escape closes the menu and puts focus on the field; Tab reaches the format chips and Copy. Ctrl or ⌘ K opens the dialog while focus is inside the block, and only then. The rows are options of a cmdk listbox; the block turns off its own fuzzy filter and lists the rows itself. The drawings in the rows are hidden from assistive technology; the names and values carry the same facts.

How does it look on a phone?

The inspector goes and the box pane stays under the list. The copy shown on load docks to the top of the page at full width, so the keyboard does not cover the foot; the key hints go and the count stays. The real dialog keeps the Command dialog's own phone layout.

  • Pro

    A design tool's tone picker as a command menu shown open over its Fill row: an eleven-step grey ramp and recent tones, a HEX, RGB or HSL switch that rewrites every value and what Enter copies, and a band with the highlighted tone's contrast on white and on black.

  • Pro

    A dashboard app's appearance menu shown open beside a live mini app: mode, corner radius, density and text size in four groups with a tick on each current choice, and a preview that restyles the moment you choose while the menu stays open.

  • Pro

    A document editor's font menu hung from the toolbar's font name, with six system font stacks each set in its own real CSS stack, a specimen band that follows the highlight, a row of weights and an italic toggle, and Enter to set the document's font.

  • Pro

    A dashboard configurator's layout switcher as a command menu docked at the end of the page: six layouts each with a greyscale diagram, a band that draws the highlighted one larger, and Enter to re-arrange the drawn dashboard, still under reduced motion.

  • Pro

    A git client's project switcher as a command menu shown open at the centre of the title bar: pinned and recent repositories with branch, host, ahead and behind, a switch that keeps only projects with changes, and a title bar and file tree that follow the choice.

  • Pro

    A payload inspector's path browser as a command menu shown open beside a value pane: the keys of an object or array with their type as a word, a path bar in monospace, the arrow keys going in and out, a typed path that jumps there, and a copy path button.