Inspector Drawer
NewDetail 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-drawerFirst 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
booleanWhether the inspector is shown.
- onOpenChangerequired
(open: boolean) => voidCalled when it should close.
- titlerequired
React.ReactNodeHeading, usually the selected item's name.
- subtitle
React.ReactNodeLine under the title, e.g. an id or status.
- tabs
InspectorTab[]Tabs. With one tab or none, `children` is shown instead.
- children
React.ReactNodeContent when there are no tabs.
- actions
React.ReactNodeButtons 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
stringExtra 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
InspectorValuesThe saved values. Edits are compared against these.
- onSave
(values: InspectorValues) => voidCalled with all values when Save is pressed.
- className
stringExtra classes for the root element.
InspectorSection
Collapsible group inside an inspector.
- titlerequired
React.ReactNodeSection heading; also the toggle.
- defaultOpen
booleanDefault
trueStart expanded. Default true.
- children
React.ReactNodeContent to render.
- className
stringExtra 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
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for ChevronDown, X
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