ki-ai-label
@kimen/elements/ki-ai-label- Source
- Agent reference
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.
<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.
<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
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
explanation | explanation | string | undefined | – | Plain-text explanation of how the content was generated. Supply a nonblank explanation to offer disclosure. Omit it for a static mark. |
generated-at | generatedAt | string | undefined | – | Optional generation date or time, displayed as supplied. |
generated-at-label | generatedAtLabel | string | 'Generated' | Visible prefix for the generation date or time. |
label | label | string | 'AI' | Short visible provenance text. Localize it with the trigger name. |
model | model | string | undefined | – | Optional plain-text model name shown in the explanation. |
model-label | modelLabel | string | 'Model:' | Visible prefix for the model name. |
popover-label | popoverLabel | string | 'About this content' | Accessible name of the non-modal explanation panel. |
revert-label | revertLabel | string | 'Revert to my text' | Visible text and accessible name of the revert action. |
revertible | revertible | boolean | false | Offer the revert action inside the explanation. Enable it when the application has the original text and handles ki-revert. |
size | size | "md" | "sm" | 'sm' | Size of the painted mark. Unknown values use the small metrics. |
trigger-label | triggerLabel | string | 'AI-generated: about this content' | Accessible name of the disclosure button. Include the visible label. |
Events
| Event | Detail type | Description |
|---|---|---|
ki-revert | CustomEvent<void> | Bubbles when a person requests their original text. Use this request to restore the original from application state. |
CSS parts
| Part | Description |
|---|---|
explanation | Source explanation paragraph. |
icon | Decorative sparkles glyph. |
label | Tinted mark containing the icon and visible text. |
metadata | Optional model and generation time. |
popover | Non-modal explanation panel. |
revert | Button that requests reversion. |
trigger | Disclosure 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.
| Token | Description |
|---|---|
--ki-ai-label-backdrop-filter | Complete filter behind the AI provenance mark. Defaults to none. |
--ki-ai-label-bg | Fill of the AI provenance mark. |
--ki-ai-label-bg-image | Optional image over the AI provenance fill. Defaults to none. |
--ki-ai-label-border-width | Border width of the panel and the forced-colors mark. |
--ki-ai-label-fg | Text and icon ink of the AI provenance mark. |
--ki-ai-label-gap | Gap between the mark and its icon or between provenance metadata items. |
--ki-ai-label-md-height | Minimum painted block size of the medium AI mark. |
--ki-ai-label-md-icon-size | Sparkles icon size in the medium AI mark. |
--ki-ai-label-md-padding-inline | Inline inset of the medium AI mark. |
--ki-ai-label-popover-backdrop-filter | Complete filter behind the provenance explanation. Defaults to none. |
--ki-ai-label-popover-bg | Raised fill of the provenance explanation. |
--ki-ai-label-popover-bg-image | Optional image over the provenance explanation fill. Defaults to none. |
--ki-ai-label-popover-border | Hairline color of the explanation panel. |
--ki-ai-label-popover-fg | Ink of the provenance explanation and metadata. |
--ki-ai-label-popover-gap | Gap between the panel sections and between the panel and trigger. |
--ki-ai-label-popover-padding | Inset of the explanation panel. |
--ki-ai-label-popover-radius | Corner radius of the explanation panel. |
--ki-ai-label-popover-shadow | Elevation of the explanation panel. |
--ki-ai-label-popover-width | Preferred inline size of the explanation panel. |
--ki-ai-label-radius | Corner radius of the AI provenance mark. |
--ki-ai-label-sm-height | Minimum painted block size of the small AI mark. |
--ki-ai-label-sm-icon-size | Sparkles icon size in the small AI mark. |
--ki-ai-label-sm-padding-inline | Inline inset of the small AI mark. |
--ki-density-target-min | The 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-color | Colour of the keyboard focus ring every focusable component draws: 3:1 or more against the page in every theme and scheme. |
--ki-focus-ring-offset | Gap between a focusable component and its keyboard focus ring. |
--ki-focus-ring-width | Thickness 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-body | semantic font family for typography family body. |
--ki-typography-line-height-caption-2 | semantic dimension for typography line height caption 2. |
--ki-typography-line-height-para | semantic dimension for typography line height para. |
--ki-typography-size-body-1 | semantic dimension for typography size body 1. |
--ki-typography-size-body-2 | semantic dimension for typography size body 2. |
--ki-typography-size-caption-2 | semantic dimension for typography size caption 2. |
--ki-typography-weight-body-semibold | semantic font weight for typography weight body semibold. |