AISuggestion
BasicFeedback
<co-ai-suggestion>AISuggestion holds content drafted by AI, in the AI purple, with its source, confidence and Accept or Edit actions.
import { AISuggestion } from 'health-components';
Examples
With Actions
Draft Reply
Usage
<AISuggestion title="Suggested codes" confidence="medium" actions={<Button variant="ai" size="sm" onClick={accept}>Accept Codes</Button>}>{suggestion}</AISuggestion>
When to use
- AI-drafted notes, code suggestions, message replies, coverage guesses.
When not to use
- Content a person wrote.
Variants and states
| Variant | What it is |
|---|---|
| default | Sparkle icon, title, "Draft, needs review" tag. |
| confidence | Confidence text on the right. |
| actions | Accept, Edit, Discard. |
Accessibility
- Region named after the title.
- Never apply AI output without a person accepting it.
Do and don't
- Do: "Suggested codes from the visit note: 99214, E11.9. Confidence medium."
- Don't: AI purple for anything that is not AI.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "AI suggestion" | Title; also names the region |
source | string | "Draft, needs review" | Tag text |
confidence | string | none | Confidence word shown on the right ("medium") |
children * | ReactNode | — | The AI-drafted content. Required. |
actions | ReactNode | none | Accept, Edit, Discard buttons |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-ai-suggestion>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-ai-suggestion title="…" source="…" [defaultValue]="defaultValue">…</co-ai-suggestion>
| Kind | Name | Description |
|---|---|---|
| attribute | title | Title; also names the region; default "AI suggestion" |
| attribute | source | Tag text; default "Draft, needs review" |
| attribute | confidence | Confidence word shown on the right ("medium"); default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| slot | (default) | The AI-drafted content. Required. |
| slot | actions | Accept, Edit, Discard buttons; default none Plain text also works as the `actions` attribute. |