PromptPanel
Floating panel root — a bordered, shadowed card that prompts the user to
pick an action or describe one. Compose it with PromptPanelHeader and
PromptPanelBody (which stacks PromptPanelOption/PromptPanelFreeform
rows); use PromptPanelStage around the body to animate between steps.
What would you like to do?
Usage
import { PromptPanel, promptPanelAnatomy, PromptPanelBody, PromptPanelBodyProps, PromptPanelFreeform, PromptPanelFreeformProps, PromptPanelHeader, PromptPanelHeaderProps, PromptPanelOption, PromptPanelOptionProps, PromptPanelProps, PromptPanelStage, PromptPanelStageProps, PromptPanelView, PromptPanelViewOption, PromptPanelViewProps, usePromptPanelKeyboard, UsePromptPanelKeyboardOptions, UsePromptPanelKeyboardResult } from "@desk/ui/components/prompt-panel";Best practices
Pass
title(or an explicitaria-label) — the panel is arole="dialog"surface floating over the canvas, so it needs an accessible name of its own.Wrap step transitions in
PromptPanelStage, not a hand-rolled page swap — it owns the Transitions.dev page-slide choreography and the reduced-motion fallback.
Props
PromptPanel
| Prop | Type | Default | Description |
|---|---|---|---|
| testId | string |
PromptPanelFreeform
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | string | "" | Uncontrolled initial value. |
| icon | IconComponent | Pencil | Leading icon. |
| inputRef | React.Ref<HTMLInputElement | null> | Ref forwarded to the underlying | |
| onSubmit | (value: string) => void | Called with the current value when Enter is pressed on non-empty text. | |
| onValueChange | (value: string) => void | Called with the next value on every keystroke (controlled or uncontrolled). | |
| shortcut | React.ReactNode | a CornerDownLeft icon | Trailing |
| value | string | Controlled value; omit for uncontrolled usage via |
PromptPanelHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | Title copy, centered regardless of whether the back button is shown. | |
| backLabel | string | "Back" | Accessible label for the back button. |
| onBack | () => void | Called when the back button is pressed. | |
| showBack | boolean | false | Show the leading back button. |
PromptPanelOption
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | Option label. | |
| highlighted | boolean | false | Keyboard-hover state — visually matches |
| shortcut | string | number | Digit shown in the leading |
PromptPanelStage
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | The current step's content — swap it whenever | |
| className | string | ||
| direction | 0 | 1 | -1 | 0 | Which way the transition travels: |
| stepKey | string | Identifies the current step; changing it triggers the transition. |
PromptPanelView
| Prop | Type | Default | Description |
|---|---|---|---|
| freeformPlaceholder | string | Placeholder for the freeform row. | |
| freeformValue | string | Controlled value for the freeform row; omit for uncontrolled usage. | |
| highlightedOptionId | string | null | Option | |
| onBack | () => void | Called when the back button is pressed, or Backspace on an empty freeform. | |
| onEscape | () => void | Called when Escape is pressed in the freeform input. | |
| onFreeformChange | (value: string) => void | Called with the next value on every freeform keystroke. | |
| onSelectOption | (id: string) => void | Called with the option's | |
| onSubmitFreeform | (text: string) => void | Called with the freeform text when it's submitted. | |
| options | PromptPanelViewOption[] | Selectable option rows, in display order. | |
| showBack | boolean | false | Show the leading back button. |
| title | string | Panel/step title. |
Also exports
- const
promptPanelAnatomy - component
PromptPanelBody - type
PromptPanelBodyProps - type
PromptPanelFreeformProps - type
PromptPanelHeaderProps - type
PromptPanelOptionProps - type
PromptPanelProps - interface
PromptPanelStageProps - interface
PromptPanelViewOption - interface
PromptPanelViewProps - const
usePromptPanelKeyboard - interface
UsePromptPanelKeyboardOptions - interface
UsePromptPanelKeyboardResult
Anatomy
PromptPanel
prompt-panelFloating panel prompting the user to pick an action or describe one
PromptPanelHeader
prompt-panel-headerCentered title with an optional leading back button
PromptPanelBody
prompt-panel-bodyStacked option/freeform rows
PromptPanelOption
prompt-panel-optionSelectable row: icon, label, trailing Kbd digit
PromptPanelFreeform
prompt-panel-freeformBorderless freeform text row with a submit Kbd