Skip to main content

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​

Storybook

Draft Reply​

Storybook

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​

VariantWhat it is
defaultSparkle icon, title, "Draft, needs review" tag.
confidenceConfidence text on the right.
actionsAccept, 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​

PropTypeDefaultDescription
titlestring"AI suggestion"Title; also names the region
sourcestring"Draft, needs review"Tag text
confidencestringnoneConfidence word shown on the right ("medium")
children *ReactNode—The AI-drafted content. Required.
actionsReactNodenoneAccept, 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>
KindNameDescription
attributetitleTitle; also names the region; default "AI suggestion"
attributesourceTag text; default "Draft, needs review"
attributeconfidenceConfidence word shown on the right ("medium"); default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
slot(default)The AI-drafted content. Required.
slotactionsAccept, Edit, Discard buttons; default none Plain text also works as the `actions` attribute.