Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Feature Toggles Settings Block for React

A feature flag settings panel with ordered targeting rules, a kill switch that asks first, and an Evaluate for a user pane that reads what the flag serves and which rule decided.

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 read a flag's rules the way the service reads them, with these feature toggle settings for React with Base UI. A hairline frame with a plus mark on each corner names the flag, new-checkout, holds its kill switch and says what the rules amount to ("live: 3 rules and an Otherwise, first match wins; 3 of 4 sample users are served On"). Turning the Switch off for everyone opens an Alert Dialog with focus on Keep it live and a destructive Turn off. The rules are a native table: rule 1 serves On to the Scale plan, rule 2 to Germany, rule 3 rolls out to a share of everyone else, and an Otherwise row closes the list. Each match rule has an attribute, an operator and a value in a Native Select and what it serves; the rollout has a share in an Input; Move up, Move down and Remove are buttons named for their rule, Add rule appends one and Undo brings the last removed rule back. Beside the table, four sample people, each with a plan, a country and a fixed bucket from 0 to 99, are native radios: pick one and read "Served On" with the rule that decided and every rule it went through. Save refuses a rule that repeats an earlier one or a share outside 0 to 100. It's built from Switch, Alert Dialog, Native Select, Input, Button, Shine Button and Guides, with a CSS entrance only. For a feature-flag service, an experiment tool or any product that targets a release.

FAQ

How do I add an attribute, a value or a person?

Add an attribute to ATTRIBUTES with its label and the values the value select offers, and a field for it to Person; factOf and matches read the attribute by name, so give each new attribute its own line there. Add a sample user to PEOPLE with a plan, a country and a bucket, and the rules SAVED holds when the page opens. The sentence on top, the table, the evaluator and the unsaved count all read from those.

How does the evaluator decide, and what is a bucket?

It reads the rules from the top and stops at the first one that matches: a match rule checks the person's plan or country against its value (is, or is not), a rollout matches when the person's bucket is under its share, and the Otherwise rule takes whoever is left. The kill switch overrides all of it. A bucket is a number from 0 to 99 that a real service computes from the flag key and the user, so a person stays on the same side of a rollout as it widens; here each person has a fixed one, typed in PEOPLE.

What does the kill switch do, and why does it ask?

Turning it off serves Off to everyone whatever the rules say, which is the one change that affects every user at once, so it asks in an alert dialog that opens with focus on Keep it live, can't be closed by clicking outside it and, once confirmed, keeps the rules as they were. Turning it on again needs no question. Focus returns to the switch when the dialog closes.

What stays local, and how do I make it real?

Everything. Nothing is flagged: the rules and the four people are typed sample data, Save keeps the rules in this page's state, Remove and Undo walk a stack in the page and a reload brings back the starting rules. To make it real, store the rules on your server, evaluate them in your SDK from the same list, in the same order, and hash the user and the flag key into the bucket.

What does Save refuse, and how are rules kept in order?

A rule that repeats an earlier match rule (same attribute, operator and value) would never run, and a rollout share must be a whole number from 0 to 100; Save names the rule, marks it and moves focus to its first control. Move up and Move down are buttons named for the rule ("Move rule 2 up"), quiet at the ends and still answering in words, and focus stays on the pressed button, or goes to the other one when the pressed button reaches an end.

How does it look on a phone, and is it accessible?

Each rule becomes a card: its number and three buttons on the first line, the attribute, operator and value in one row and what it serves under them, so a rule reads on one screen. Every control has a name that says which rule it belongs to, the radios are in a fieldset with a legend and the status line is a polite live region that announces moves, removals and who a flag serves.

  • Pro

    A confirmation panel for a feature flag that went live: a strip of figures over a rollout dial that moves by stops, an Environment switch, the number of users it reaches worked out from typed audiences, and a local Roll back.

  • Pro

    Environment Variables Settings

    Domains and delivery

    An environment variables settings panel that shows where each variable is set across Production, Preview and Development, counts what is missing, fills a missing value with Copy from, and previews a pasted .env file before it imports.

  • Pro

    A pipeline settings window that draws its stages as cards on a canvas, redraws the lines when a stage runs in parallel, and recomputes the total time, with an inspector for each stage.

  • Pro

    Rate Limiting Settings

    API and webhooks

    A rate limit you can try: a framed strip replays one client's 24 requests over 10 seconds against the chosen algorithm, limit, window and burst, marking each request allowed or rejected and counting both.

  • Pro

    A branch protection settings panel with a branch picker, approval and check rules, merge methods and a tester that says whether a pull request would merge and every reason it would not.

  • Pro

    A build settings panel for a static-site host: a preset fills the folder and commands, and a dark terminal writes the build log from the fields, or stops at the error a real runner would give.