Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. Detail Drawer
  3. API and Development

Detail Drawer

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import DetailDrawer, DetailDrawerSection from @prepared911/ui/blocks/detail-drawer. See props.ts for the props and schema.ts for the declaration (inputs and slots).
DetailDrawer
PropTypeDefault
openbooleanrequired
onOpenChange(open: boolean, details: DetailDrawerOpenChangeDetails) => voidnone
recordIdstringrequired
onRecordChange(recordId: string, details: DetailDrawerRecordChangeDetails) => voidnone
labelLocalizedMessage (names the drawer)required
titleLocalizedMessage | DisplayValue (the header h2)required
subtitleLocalizedMessage | DisplayValuenone
closeLabelLocalizedMessagerequired
triggerone Button or Link elementnone
actionsReactNode (Buttons, ButtonGroup, a Menu)none
childrenReactNode (the body)none
footerReactNode (Buttons, primary last)none
footerTextLocalizedMessagenone
recordsreadonly DetailDrawerRecord[] (needs recordsLabel)none
recordsLabelLocalizedMessage (needs records)none
loadingbooleanfalse
loadingLabelLocalizedMessagerequired
errorLoadingBoundaryErrorSlot (ErrorBoundary props without children)none
guardDetailDrawerGuardnone
scrollRegionLabelLocalizedMessagenone
refRef<HTMLDialogElement> (the drawer panel, for measuring it)none
placementDrawerPlacement (Drawer's layout of the panel)Viewport
resizeLabelLocalizedMessage (names a resize handle; the drawer resizes)none
onOpenChange details carry a PopupOpenChangeReason (close-press, close-request, light-dismiss, trigger-press, imperative-action) and are cancelable except when the drawer asks you to restore your request. onRecordChange details carry item-press or list-navigation from the strip, or imperative-action from a kept edit.
DetailDrawerRecord
FieldType
idstring
labelLocalizedMessage
disabledboolean
DetailDrawerGuard
FieldType
dirtyboolean
titleLocalizedMessage
descriptionLocalizedMessage
keepEditingLabelLocalizedMessage
discardLabelLocalizedMessage
onDiscard() => void
DetailDrawerSection
PropType
titleLocalizedMessage (an h3)
childrenReactNode
Props
NameTypeDefaultDescription
closeLabelLocalizedMessage—Accessible name of the close control.
labelLocalizedMessage—Accessible name of the drawer, such as "Incident details". The record's title is the header heading.
loadingLabelLocalizedMessage—Name of the pending state. It labels the skeletons and the boundary around the body.
openboolean—Whether the drawer is shown. The caller owns it; the drawer reports requests through onOpenChange.
recordIdstring—Id of the record to show. There is one drawer: changing this while it is open swaps the content in place and never stacks a second drawer. With a dirty guard, the swap waits for the person's choice.
titleLocalizedMessage | DisplayValue—The record's title, rendered as the header heading (h2). Required while loading, so the heading keeps its name.
actionsReactNode—The header action menu: an icon button that opens it. A text Edit control is not a header action. Close is closeLabel.
childrenReactNode—The scrolling body. Compose {@link DetailDrawerSection } for detail sections. It may suspend or throw: the body sits in a {@link LoadingBoundary }.
errorLoadingBoundaryErrorSlot—ErrorBoundary props for the body. A throw while the body renders shows the recovery in place of the body, and a new record id resets it. Omit it and the error propagates to the nearest outer boundary.
footerReactNode—Footer actions at the inline end, below a divider. The primary action goes last.
footerTextLocalizedMessage—Supporting text at the inline start of the footer.
guardDetailDrawerGuard—The unsaved-changes guard. Omit it and the drawer never asks.
loadingboolean—Shows skeletons for the title and the body while the record loads. The drawer stays enabled, so the person can still close it or move to another record.
onOpenChange((open: boolean, details: DialogOpenChangeDetails) => void)—Called with the requested open state when the person presses the trigger or the close control, presses Escape, or presses outside the drawer. A cancelable request is vetoed with details.cancel(). With a dirty {@link DetailDrawerProps.guard}, set open to false as usual: the drawer keeps showing the record and asks first.
onRecordChange((recordId: string, details: DetailDrawerRecordChangeDetails) => void)—Called with the id of the record the person chose in the record strip.
placementDrawerPlacementDrawerPlacement.ViewportWhere the drawer is laid out: fixed to the viewport, over its nearest positioned ancestor, or in the flow beside the content it describes (Drawer's placement, DD-21).
recordsreadonly DetailDrawerRecord[]—Related records the person can move between. Keep the set small: each one is a segment.
recordsLabelLocalizedMessage—Accessible name of the strip, such as "Related incidents".
refRef<HTMLDialogElement>—Ref to the drawer's dialog panel, for a page that measures it, such as a table that reserves scroll room beside an open drawer.
resizeLabelLocalizedMessage—Name of a resize handle on the drawer's inner edge. Set it and the drawer resizes between Small and Large.
scrollRegionLabelLocalizedMessage—Name of the body's scroll region when it overflows with no focusable content and becomes focusable.
subtitleLocalizedMessage | DisplayValue—Supporting line under the title, such as status or location.
triggerDialogControlElement—The control that opens the drawer. Omit it for a drawer opened from elsewhere on the page.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Detail Drawer / Usage
Next
Detail Drawer / Accessibility
On this page
DetailDrawer
DetailDrawerRecord
DetailDrawerGuard
DetailDrawerSection
Props
Storybook