AI Suggested Value
An AI-proposed value for any form control, pending until accepted and marked afterwards.
- AI
- 1 file
- No extra npm packages
- Accessibility notes
pnpm dlx @dowel-ui/cli add ai-suggested-valueNo npm packages are needed beyond what Dowel already requires.
import { SuggestedValue } from "@/components/ui/ai-suggested-value";Default
Wired
On ASelect
Low Confidence
Arriving
<SuggestedValue>
| Prop | Type | Default |
|---|---|---|
label (required)The field, for the buttons' names: "Accept suggestion — Company". | string | — |
onAccept (required) | (value: T, suggestion: Suggestion<T>) => void | — |
children (required)The control. Receives the description, and any id or ARIA a FormControl passes down. | ReactElement<Record<string, unknown>> | — |
announceAnnounce a suggestion when it arrives. Off by default: a form that fills twenty fields at once would narrate all twenty, and the description on the control already tells a reader when they reach the field. | boolean | false |
aria-describedby | string | — |
aria-invalid | ComponentPropsWithRef<"input">["aria-invalid"] | — |
equalsHow to compare values. Object.is by default. | (a: T, b: T) => boolean | Object.is |
id | string | — |
lowConfidenceBelowConfidence below this is called low, in words. | number | 0.7 |
onDismiss | (suggestion: Suggestion<T>) => void | — |
onRevertCalled with the value the field held before the fill, so it can be put back. | (previous: T | undefined) => void | — |
statusSupply to own the status; otherwise it is kept here. | SuggestionStatus | — |
suggestionNull or undefined offers nothing. A different suggestion starts pending again. | Suggestion<T> | null | — |
valueThe control's current value. Lets the marker say the fill was edited since, and lets Undo restore what the field held before. | T | — |
Plus every attribute of <div> except children, id, aria-describedby, aria-invalid.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes