Inspector Align

About this component

Inspector Align

Where the contents of a box sit in it: nine cells drawn in visual terms, mapped onto justify and align afterwards so the pair swapping places under a column direction is the component's problem and not the reader's. Direction, distribution and stretch sit under the pad as rows of the family, since each is a setting like any other.

Usage

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

import { InspectorAlign, alignToCss } from "@/components/beste/component/inspector-align";

<InspectorAlign label="Align" defaultValue={{ justify: "center", align: "center" }} />

<InspectorAlign
  label="Content"
  value={align}                  // { justify, align, direction, distribute }
  onValueChange={setAlign}
  onOpenChange={(open) => console.log("editor open:", open)}
  directional={false}            // drop the row/column choice for a box that is always one
  distributable                  // space-between and its neighbours, on by default
  stretchable                    // stretch across the cross axis, on by default
  tone="outline"                 // "muted" (default) | "outline" | "ghost"
  size="sm"                      // "sm" | "default" | "lg"
/>

// The CSS the value stands for, so a panel does not rebuild the mapping
<div style={alignToCss(align)}>{children}</div>

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.

Enter / SpaceOpen the editor from the row
TabWalks the nine cells in the order they read
EscapeClose the editor, leaving the value alone

Props

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

PropTypeDefaultDescription
label*string—Label rendered on the left, inside the row.
iconLucideIcon—Optional leading icon shown before the label.
valueAlignValue—Controlled value. Pair it with `onValueChange`.
defaultValueAlignValue—Initial value in uncontrolled mode.
onValueChange(value: AlignValue) => void—
onOpenChange(open: boolean) => void—Fires when the editor opens or closes.
directionalbooleantrueOffer the direction, which decides which axis `justify` is on.
distributablebooleantrueOffer space-between and its neighbours.
stretchablebooleantrueOffer `stretch` across the cross axis.
disabledboolean—Block 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-labelstring—Accessible name. Falls back to `label`.

More Inspector components

View all Inspector