Inspector Switch

Settings row with a label on the left and a switch on the right, sharing the family's pill: the label takes the row's spare width, so a press almost anywhere toggles it.

Installation

Adds the component and everything it depends on to your project.

npx shadcn add https://ui.beste.co/component/r-base/inspector-switch

New here? Read the installation guide.

Usage

The import and the props worth knowing about, in one place.

import { InspectorSwitch } from "@/components/beste/component/inspector-switch";

// Uncontrolled
<InspectorSwitch label="Parallax" defaultChecked />

// Controlled. The props are named after the switch, not the family's `value`,
// because that is what every other switch already speaks.
<InspectorSwitch
  label="Show captions"
  checked={captions}
  onCheckedChange={setCaptions}
/>

<InspectorSwitch
  label="Reduce motion"
  icon={Accessibility}   // optional leading icon
  tone="outline"         // "muted" (default) | "outline" | "ghost"
  size="sm"              // "sm" | "default" | "lg"
  checked={reduced}
  onCheckedChange={setReduced}
/>

// Disabled, and taking part in a form
<InspectorSwitch label="Autoplay" checked={autoplay} onCheckedChange={setAutoplay} disabled={isLocked} />
<InspectorSwitch label="Marketing emails" name="marketing" defaultChecked={false} />

Playground

Turn the props on the right; the snippet under them is what you would write to get what you see.

Usage
import { InspectorSwitch } from "@/components/beste/component/inspector-switch";

<InspectorSwitch
  label="Auto layout"
  defaultChecked
/>

Keyboard and gestures

Every one of these is in the component already. They are listed because a props table cannot mention a gesture, so nothing else on this page can tell you they exist.

Space / EnterFlip it. The switch is a button, so both keys work on it.
Click anywhere in the rowThe label owns the row's spare width and points at the switch by id, so the target is the whole row rather than the track at its end.

Props

Read from the component's own type, so this cannot drift from what it accepts.

PropTypeDefaultDescription
label*stringLabel rendered on the left, inside the row.
iconLucideIconOptional leading icon shown before the label.
checkedbooleanControlled state. Named after the switch rather than the family's `value`, because every switch in this codebase already speaks `checked`/`onCheckedChange`.
defaultCheckedbooleanInitial state in uncontrolled mode.
onCheckedChange(checked: boolean) => void
disabledbooleanBlock interaction and dim the row.
tone"muted" | "outline" | "ghost""muted"Surface treatment: filled (default), hairline outline, or bare until hover.
size"sm" | "default" | "lg""default"Row height preset.
namestringName of the underlying control, so the row can take part in a form.
idstringId of the switch. Generated when omitted, to tie the label to it.
classNamestring
aria-labelstringAccessible name. Falls back to the visible label.

More Inspector components

View all Inspector

Inspector Input

Settings row with a label on the left and a plain text field on the right, sharing the family's pill: the whole row is the label, so pressing anywhere puts the caret in the field.

Borders

Inspector Toggles

Settings row holding a set of pills that are each on or off, so any number of them can be on at once: what inspector-segmented is for one choice out of several, this is for several choices at once, and what inspector-switch is for a single flag, this is for a handful that belong together.

Dark Mode

Inspector Segmented

Settings row whose choices sit side by side on the right, with a marker that slides between them: the readable alternative to a switch when the two states deserve names, and the compact one to a select at three or four options.

Inspector Select

Settings row that pairs a label with its current choice inside one pill, opening a width-matched dropdown below: option icons, colour swatches, descriptions and grouped sections, on top of the accessible shadcn select.

CustomWhatever you put here

Inspector Row

The family's escape hatch: label on the left, whatever you hand it on the right, and the same surface, metrics and focus ring as every other row, so a control the family does not have yet still looks like it belongs.

Inspector Border

Settings row for a border: the row draws one exactly as described beside a summary of it, and opens an editor with the sides as icon toggles and the width, style and colour under them, each one a row of the family.