Skip to content
synccn

Inspector Drawer

New

Detail panel for the selected item: tabs, collapsible sections, editable properties with unsaved-change tracking.

Select a service to inspect it.

Installation

$ pnpm dlx shadcn@latest add @synccn/inspector-drawer

First time in this project? Connect synccn with one command.

Usage

import { InspectorDrawer, InspectorProperties, InspectorSection } from "@/components/ui/inspector-drawer";<InspectorDrawer open={!!item} onOpenChange={close} title={item.name} tabs={tabs} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

InspectorDrawer

Detail panel for whatever is selected in a table, board or dashboard. Tabs, collapsible sections, editable properties and actions; as a modal sheet or an inline side panel.

  • openrequired
    boolean

    Whether the inspector is shown.

  • onOpenChangerequired
    (open: boolean) => void

    Called when it should close.

  • titlerequired
    React.ReactNode

    Heading, usually the selected item's name.

  • subtitle
    React.ReactNode

    Line under the title, e.g. an id or status.

  • tabs
    InspectorTab[]

    Tabs. With one tab or none, `children` is shown instead.

  • children
    React.ReactNode

    Content when there are no tabs.

  • actions
    React.ReactNode

    Buttons pinned to the bottom.

  • variant
    "modal" | "inline"

    Default "modal"

    "modal" slides over the page with a backdrop; "inline" sits beside your content as a panel.

  • side
    "right" | "left" | "bottom"

    Default "right"

    Edge for the modal variant.

  • className
    string

    Extra classes for the root element.

InspectorProperties

Editable property list with per-field change markers and a save bar for unsaved edits.

  • fieldsrequired
    InspectorField[]

    Fields to edit, in order.

  • valuesrequired
    InspectorValues

    The saved values. Edits are compared against these.

  • onSave
    (values: InspectorValues) => void

    Called with all values when Save is pressed.

  • className
    string

    Extra classes for the root element.

InspectorSection

Collapsible group inside an inspector.

  • titlerequired
    React.ReactNode

    Section heading; also the toggle.

  • defaultOpen
    boolean

    Default true

    Start expanded. Default true.

  • children
    React.ReactNode

    Content to render.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Components

Helpers

npm packages

Keyboard

  • TaborShift+TabMove focus; it stays inside while open
  • EscClose
  • EnterorSpaceOpen or close a section

Accessibility

  • The inline panel is an aside labelled by its title; the modal variant is a dialog.
  • Changed fields are marked with text for screen readers, not only a dot.
  • Sections use aria-expanded and aria-controls.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: status
  • ARIA attributes: aria-controls, aria-expanded, aria-label, aria-labelledby
  • Closes with Escape
  • Shows a visible focus ring for keyboard users
  • Includes text only screen readers hear
  • Labels are tied to their controls
  • Announces changes to screen readers