Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Feature Flags Command Menu Block for Svelte

A feature-flag platform's command menu shown open on its Flags page: a Dev, Staging and Production switch re-reads nine flags, and each row switches the flag and steps its rollout by ten points.

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

Flip a flag in the right environment with this feature flags command menu for Svelte with Ark UI. It opens from the Flags page of Flagmoor, a feature-flag platform, whose header holds an outline field with its ⌘ K cap, and the page's list is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The menu is the catalog Command over nine flags in three groups, Checkout, Search and Platform, with a three-way ToggleGroup above the field: Dev, Staging and Production. A flag has its own value in each, so the switch re-reads every row in the environment you pick. Each row shows a drawn switch, the flag's key and a rollout percentage with a minus and a plus; Enter flips the flag, Alt with the left or right arrow (Option on a Mac) lowers or raises its rollout by ten points while it is on, and the menu stays open for both. The foot counts "4 on in Staging", and the drawn list behind it shows the same switches with each rollout as a filled bar. 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 flags, environment and query. For flag consoles, config tools and any setting that has a value per environment.

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 drawn inline over a picture of the Flags page, 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 a flag you switched in the copy is there in the dialog. 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 the environment switch do?

It changes which value every row shows, and which one a press changes. A flag is a Flag with a Cell for each environment, { on, pct }, and cellOf(flag, env) reads the one for the shown environment, so a flag can be on in Dev, half on in Staging and off in Production. Switching the environment announces how many flags are on there, and the switch always has one chosen so the list is never unexplained.

How does the rollout step work?

The minus and the plus on a row, or Alt with the left and right arrows from the highlighted row, move the rollout by ten points between 0 and 100. A flag that is off cannot be stepped: the buttons read as disabled and the status line says to switch it on first. Turning a flag on from 0% starts it at 10%, so "on" never means nobody. The buttons take no focus of their own, so the highlighted row stays where it is; the keys are the keyboard route, and the status line says the new value.

What stays local, and how do I wire it?

All of it. The flags and their values are state in the block, and every status line ends with "In this demo only". In your app load START from your flag service, send the change from flip and nudge, and read the environment names from your project. Keep the confirmation for Production: a flag that reaches real users deserves a second step before it flips.

Is it accessible from the keyboard?

Yes. Type to search the keys, the arrow keys move through the rows, Enter flips the flag and Space does too while the field is empty. Alt with the left or right arrow steps the rollout of the highlighted row, and the environment switch is a group of toggle buttons above the field. Escape closes the menu with focus on the field; Ctrl or ⌘ K opens the dialog while focus is inside the block, and only then. The rows are options of a combobox and the first is highlighted when it opens.

How does it look on a phone?

The copy shown on load docks to the top of the stage so the keyboard does not cover the foot. In each row the rollout moves under the key instead of beside it, the key hints go and the count stays. The real dialog keeps the Command dialog's own phone layout.