Feature Flags Table

Flags with their key, environments, rollout meter and a live switch that saves optimistically.

PROGet Feature Flags Table and 168 other Pro components with pro lifetime — Get Pro

Category
Data Tables
Access
Pro
Source
262 lines · one file
States
7 drawn
Kind
Block

The decision inside it

A failed save is visible

Optimistic switches usually fail silently. This one returns to where it was and says Not saved in the row, so a dropped request is never mistaken for a change.

When to use it

Use Feature Flags Table to list flags with their key, environments and rollout, and turn them on or off in the row. onToggle may return a promise; if it rejects the switch goes back and the row says Not saved.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Feature Flags Table for this.
Install it: npx shadcn@latest add @liro/feature-flags-table
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/feature-flags-table.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/feature-flags.tsx
import { FeatureFlagsTable, type FeatureFlag } from "@/components/ui/feature-flags-table";

export function Flags({ rows }: { rows: FeatureFlag[] }) {
  return (
    <FeatureFlagsTable
      rows={rows}
      environments={["development", "staging", "production"]}
      onToggle={async (flag, enabled) => {
        const res = await fetch("/api/flags/" + flag.key, { method: "PATCH", body: JSON.stringify({ enabled }) });
        if (!res.ok) throw new Error("Not saved");
      }}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
rowsFeatureFlag[] Yes–
environmentsstring[] NoEvery environment, in order. Default development, staging, production.
onToggle(flag: FeatureFlag, enabled: boolean) => void | Promise<void> NoSave the change. Reject to put the switch back.
loadingboolean No–
errorReact.ReactNode No–
onRetry() => void No–
onRowClick(row: FeatureFlag) => void No–
density"comfortable" | "compact" No–
variant"default" | "striped" | "bordered" No–
pageSizenumber NoRows per page. Default 8.
classNamestring No–

Dependencies

npm packages

clsxtailwind-merge

Liro foundations, installed alongside it

liro-themedata-tableswitch

States

All of them are drawn by the component. None is left for you to design.

  • All flags
  • Toggling
  • Save failed
  • Off
  • Loading
  • Empty
  • Error

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances