Skip to content
Kimenpre-v1documentation home
Color scheme

ki-ai-label

Use an AI label beside a generated passage or suggested value. The small tinted mark can stand alone. A plain-text explanation enables the disclosure, where the model and generation time can also appear.

Theme for this example
Color scheme for this example
<ki-ai-label explanation="Written from the incident reports of the last 30 days." model="Standard" generated-at="2026-11-19T10:32"></ki-ai-label>

Suggested field values

Put the AI label directly in the ki-input end slot to add “Suggested by AI” to the field description. When the application has the person’s original text, use revertible with an explanation and listen for ki-revert to restore it.

Theme for this example
Color scheme for this example
<ki-input label="Subject" value="Incident summary"><ki-ai-label slot="end" explanation="Suggested from the incident reports."></ki-ai-label></ki-input>

Accessibility

The disclosure button opens a named non-modal dialog. Focus moves inside. Escape returns it to the button, and Tab can continue through the page. The static mark adds no tab stop. Translate label, trigger-label, popover-label, model-label, generated-at-label and revert-label as applicable. On ki-input, translate ai-suggestion-text.

API reference

When to use: Mark text or a value generated by AI. Include the source in explanation when people can inspect how it was generated. In a ki-input, place the label in the end slot to describe the field's provenance.

When not to use: Use a status component for active generation or processing, and an application action for changes that do not restore the person's text.

Properties & attributes

AttributePropertyTypeDefaultDescription
explanationexplanationstring | undefined–Plain-text explanation of how the content was generated. Supply a nonblank explanation to offer disclosure. Omit it for a static mark.
generated-atgeneratedAtstring | undefined–Optional generation date or time, displayed as supplied.
generated-at-labelgeneratedAtLabelstring'Generated'Visible prefix for the generation date or time.
labellabelstring'AI'Short visible provenance text. Localize it with the trigger name.
modelmodelstring | undefined–Optional plain-text model name shown in the explanation.
model-labelmodelLabelstring'Model:'Visible prefix for the model name.
popover-labelpopoverLabelstring'About this content'Accessible name of the non-modal explanation panel.
revert-labelrevertLabelstring'Revert to my text'Visible text and accessible name of the revert action.
revertiblerevertiblebooleanfalseOffer the revert action inside the explanation. Enable it when the application has the original text and handles ki-revert.
sizesize"md" | "sm"'sm'Size of the painted mark. Unknown values use the small metrics.
trigger-labeltriggerLabelstring'AI-generated: about this content'Accessible name of the disclosure button. Include the visible label.

Events

EventDetail typeDescription
ki-revertCustomEvent<void>Bubbles when a person requests their original text. Use this request to restore the original from application state.

CSS parts

PartDescription
explanationSource explanation paragraph.
iconDecorative sparkles glyph.
labelTinted mark containing the icon and visible text.
metadataOptional model and generation time.
popoverNon-modal explanation panel.
revertButton that requests reversion.
triggerDisclosure button, available with an explanation.

CSS custom properties

The public styling contract of ki-ai-label: reassign these tokens at :root or on a subtree — never override internals.

TokenDescription
--ki-ai-label-backdrop-filterComplete filter behind the AI provenance mark. Defaults to none.
--ki-ai-label-bgFill of the AI provenance mark.
--ki-ai-label-bg-imageOptional image over the AI provenance fill. Defaults to none.
--ki-ai-label-border-widthBorder width of the panel and the forced-colors mark.
--ki-ai-label-fgText and icon ink of the AI provenance mark.
--ki-ai-label-gapGap between the mark and its icon or between provenance metadata items.
--ki-ai-label-md-heightMinimum painted block size of the medium AI mark.
--ki-ai-label-md-icon-sizeSparkles icon size in the medium AI mark.
--ki-ai-label-md-padding-inlineInline inset of the medium AI mark.
--ki-ai-label-popover-backdrop-filterComplete filter behind the provenance explanation. Defaults to none.
--ki-ai-label-popover-bgRaised fill of the provenance explanation.
--ki-ai-label-popover-bg-imageOptional image over the provenance explanation fill. Defaults to none.
--ki-ai-label-popover-borderHairline color of the explanation panel.
--ki-ai-label-popover-fgInk of the provenance explanation and metadata.
--ki-ai-label-popover-gapGap between the panel sections and between the panel and trigger.
--ki-ai-label-popover-paddingInset of the explanation panel.
--ki-ai-label-popover-radiusCorner radius of the explanation panel.
--ki-ai-label-popover-shadowElevation of the explanation panel.
--ki-ai-label-popover-widthPreferred inline size of the explanation panel.
--ki-ai-label-radiusCorner radius of the AI provenance mark.
--ki-ai-label-sm-heightMinimum painted block size of the small AI mark.
--ki-ai-label-sm-icon-sizeSparkles icon size in the small AI mark.
--ki-ai-label-sm-padding-inlineInline inset of the small AI mark.
--ki-density-target-minThe smallest pointer target any density may produce: 24 x 24 CSS px by default and in compact (WCAG 2.5.8 AA), 44 x 44 in touch (WCAG 2.5.5). It floors a shrinking control but never lifts what a control paints: a control painted smaller extends its target to it, invisibly; rows and tabs grow to it (spec 045 A1).
--ki-focus-ring-colorColour of the keyboard focus ring every focusable component draws: 3:1 or more against the page in every theme and scheme.
--ki-focus-ring-offsetGap between a focusable component and its keyboard focus ring.
--ki-focus-ring-widthThickness of the keyboard focus ring every focusable component draws (its outline). One token instead of one per component, so a mode or a theme changes every ring at once.
--ki-typography-family-bodysemantic font family for typography family body.
--ki-typography-line-height-caption-2semantic dimension for typography line height caption 2.
--ki-typography-line-height-parasemantic dimension for typography line height para.
--ki-typography-size-body-1semantic dimension for typography size body 1.
--ki-typography-size-body-2semantic dimension for typography size body 2.
--ki-typography-size-caption-2semantic dimension for typography size caption 2.
--ki-typography-weight-body-semiboldsemantic font weight for typography weight body semibold.

Workshop

Open ki-ai-label in Storybook