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

Tool

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import Tool, ToolState from @prepared911/ui/tool.
Tool
PropTypeDefaultNotes
namestringrequiredTool identifier, rendered as code.
stateToolState | ToolStateValuerequiredPicks the badge intent and label.
statusLabelsRecord<ToolStateValue, LocalizedMessage>requiredBadge label for every state.
inputunknownPrinted as JSON unless null or undefined.
inputLabelLocalizedMessagerequiredHeading above the input.
outputunknownPrinted as JSON unless null or undefined.
outputLabelLocalizedMessagerequiredHeading above the output.
errorTextLocalizedMessage | DisplayValueFailure text.
openbooleanControlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean, details: ChangeDetails) => voidReason is trigger-press.
classNamestringAppended to the root.
ToolState
InputStreaming (input-streaming, informative badge), InputAvailable (input-available, neutral), OutputAvailable (output-available, success) and OutputError (output-error, destructive).
Props
NameTypeDefaultDescription
inputLabelLocalizedMessage—Heading above the input JSON, for example "Input".
namestring—The tool's identifier, for example queryAnalytics. It is data, not copy, and reads left to right.
outputLabelLocalizedMessage—Heading above the output JSON, for example "Output".
state"input-streaming" | "input-available" | "output-available" | "output-error"—Lifecycle state. It picks the status badge's intent and its label from statusLabels. A ToolState member or its string, so the state of a streamed tool part is accepted as it arrives.
statusLabelsReadonly<Record<"input-streaming" | "input-available" | "output-available" | "output-error", LocalizedMessage>>—The badge label for every state, for example "Running" for ToolState.InputStreaming.
classNamestring—Classes appended to the root.
defaultOpenbooleanfalseInitial open state when uncontrolled.
errorTextLocalizedMessage | DisplayValue—Failure text, shown in the destructive color. It is runtime data, so a {@link DisplayValue} is accepted.
inputunknown—Tool input, shown as formatted JSON when it is not null or undefined.
onOpenChangeToolOpenChangeHandler—Fires when the trigger requests a change.
openboolean—Controlled open state.
outputunknown—Tool output, shown as formatted JSON when it is not null or undefined.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Tool / Usage
Next
Tool / Accessibility
On this page
Tool
ToolState
Props
Storybook