@get-asset/react
AssetAsk
Drop-in styled free-text ask: an “Ask something else” chip (the same anatomy as the insights question chips) that expands, in place, into a full-width input with a submit. The insights panel embeds it for you on the Profit & Loss and Cashflow Summary cards and the reports that embed the panel — reach for it directly only when attaching a free-text ask to something else. Renders nothing while the surrounding card is locked.
Built on the headless Ask compound from @get-asset/sdk.
Preview
API reference
Root props
| Prop | Type | Default | Description |
|---|---|---|---|
onSubmit | (question: string) => void | — | Handles a submitted question (already trimmed, never empty). The host decides what asking means — the insights panel wires it to its select(). |
placeholder | string | — | Placeholder (and accessible label) for the input. Pass a report-specific prompt. Defaults to "Ask about this report…". |
disabled | boolean | — | Disable the input + submit (e.g. while an answer generates). |
locked | boolean | — | Override the locked state. Defaults to the surrounding lockable card's state. While locked the component renders nothing. |
defaultOpen | boolean | — | Start on the expanded input instead of the chip — for storybook/docs previews of the expanded state. |
maxLength | number | — | Cap the question length (native input maxLength). Pass your endpoint's limit — the insights panel passes 500, the insights endpoints' question cap. |
className | string | — | Forwarded to the outer element of both states (chip and input row). |
Behavior notes
- Enter or the arrow button submits; the submit stays disabled until non-whitespace text is entered. Submitting collapses back to the chip and clears the field.
- Escape or blurring while empty collapses back to the chip; blurring with a draft keeps the input open.
- The expansion unfurls left→right over 260ms; users with reduced motion get an instant swap.
- In a wrapping chip row the expanded input takes the full row width, so it always occupies its own line.