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.

Installation

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

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

New here? Read the installation guide.

Usage

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

import { InspectorBorder } from "@/components/beste/component/inspector-border";

// Uncontrolled. Opens on all four sides, 1px, dashed.
<InspectorBorder label="Border" />

// An empty `sides` list is no border, so the width never has to carry a zero to
// mean the same thing.
<InspectorBorder label="Border" defaultValue={{ sides: ["bottom"], width: 2, style: "solid" }} />

// Controlled, with a separate commit for expensive work
<InspectorBorder
  label="Card border"
  value={border}
  onValueChange={setBorder}
  onValueCommit={(value) => save(value)}
/>

<InspectorBorder
  label="Divider"
  icon={SquareIcon}      // optional leading icon
  tone="outline"         // "muted" (default) | "outline" | "ghost"
  size="sm"              // "sm" | "default" | "lg"
  maxWidth={8}           // widest the border may be, in px
  styles={["solid"]}     // one entry fixes the style and drops the choice
  alpha                  // carry an alpha channel through the colour
  format="oklch"         // notation the colour is written back in
  value={border}
  onValueChange={setBorder}
/>

// What the value turns into. Per side rather than one `border`, since the whole
// point of the row is that the four sides differ.
const side = (name) =>
  border.sides?.includes(name) ? `${border.width}px ${border.style} ${border.color}` : undefined;

<div
  style={{
    borderTop: side("top"),
    borderRight: side("right"),
    borderBottom: side("bottom"),
    borderLeft: side("left"),
  }}
/>

Playground

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

Usage
import { InspectorBorder } from "@/components/beste/component/inspector-border";

<InspectorBorder
  label="Border"
  className="w-72"
/>

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.
valueBorderValueControlled value. Pair it with `onValueChange`.
defaultValueBorderValueInitial value in uncontrolled mode.
onValueChange(value: BorderValue) => voidFires on every adjustment, including each keystroke in the width field.
onValueCommit(value: BorderValue) => voidFires once an adjustment is finished — a side toggled, a width committed, a colour released. Use it for work too expensive to run per keystroke.
onOpenChange(open: boolean) => voidFires when the editor opens or closes.
maxWidthnumber12Widest the border may be, in px.
stylesBorderStyle[]["solid", "dashed", "dotted"]Which line styles to offer. Pass one to fix the style and drop the choice from the editor.
format"hex" | "oklch" | "rgb"Notation the colour is written back in.
alphabooleanCarry an alpha channel through the colour.
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.
classNamestring
aria-labelstringAccessible name. Falls back to `label`.

More Inspector components

View all Inspector

Inspector Corners

Settings row for the four corners of a box: the row carries a border-radius shorthand summary and a glyph rounded to match, and opens a square where each field sits on the corner it rounds.

Inspector Icon

Settings row that names the chosen icon and shows it on the right; pressing the row opens a searchable palette below it, width-matched to the row, with clearing offered at the foot of it. The icon set is passed in, so the row never bundles an icon library of its own.

Inspector Spacing

Settings row for the four edges of a box: the row carries a CSS-shorthand summary, and opens a cross where each field sits on the edge it sets, tied together or not.

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 Position

Settings row for a point on a surface: the row names the nine spots CSS names and shows the rest as two percentages, and opens a square pad the point is dragged around, with the thirds drawn on it and a pull towards them.

Inspector Gradient

Settings row for a gradient: the row shows a strip of it, and opens an editor with draggable stops over the ramp, so one colour can hold a wider share than the next. The kind, the direction and the selected stop's colour and offset sit under it as rows of the family.