Skip to content

Atoms · AI label

AI label

Marks content as made by AI, and on request says why. Given an explanation, the mark is a button that opens a short note right under it, with an optional list of sources. It is a disclosure (a button that shows and hides a region), not a tooltip or a popover: a tooltip can't hold links and never shows on a touch screen, and the system has no popover.

Best for
Marking a block of text, a value or a field that an AI wrote, so the person knows to check it.
Not for
A status or a category: use Badge. A field the AI filled: give the field aiValue, which marks it itself.

This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).

Examples

Static mark

Generated by AI
Code
tsx
<AiLabel />

With an explanation and sources

Reviewers find the gearbox quiet and the hop-up easy to tune; two mention a loose stock.

Code
tsx
<div className="flex flex-col gap-2 max-w-md">  <AiLabel    label="AI summary"    explanation="Summarised from the three most recent reviews of this replica. It can miss details or get them wrong: verify before you rely on it."    sources={[      { label: 'Review by Ilse Varga', href: '#review-1' },      { label: 'Review by Tomas Brandt', href: '#review-2' },    ]}  />  <p className="text-sm text-[var(--color-text-primary)]">    Reviewers find the gearbox quiet and the hop-up easy to tune; two mention a loose stock.  </p></div>

Anatomy

PartWhat it is
MarkA sparkle and the label in uppercase mono, in ai.text. Static text when there is no explanation.
Disclosure buttonWith an explanation, the mark is a button with aria-expanded and a chevron that turns when open. Its name is the label.
ExplanationA region right under the button, edged in ai.border, in text.secondary. Hidden until asked for, then next in the reading order.
SourcesOptional. A list of links under the explanation, drawn through renderLink.

Props

labelstringDefault 'Generated by AI'
The mark's words, and the button's name. Say what the AI made: 'AI summary', 'AI draft'.
explanationReactNode
Why this is AI content and what to do about it, in a sentence or two: what it was made from, and that it needs checking. Without it the mark is static text and nothing opens.
sourcesAiLabelSource[]
{ label, href } for each thing the content was made from. Listed under the explanation; ignored without one.
renderLink(props: LinkRenderProps) => ReactNodeDefault a plain anchor
How each source link is drawn. Pass your router's link component for sources inside the app.
classNamestring
Merged with the root's classes. When Tailwind utility classes clash, the later one wins.
refRef<HTMLDivElement>
Passed through to the root div.
...restHTMLAttributes<HTMLDivElement>
Every native attribute, onto the root div.

Keyboard

KeysResult
TabMoves focus to the mark when it has an explanation, then into any source links once open.
EnterSpaceOpens or closes the explanation. Focus stays on the button.

Do and don't

Do

  • Put it right above or beside the AI content it marks, not in a page header far away.
  • Say in the explanation what the AI used and that the person should check it, the way GitLab's 'Verify before use' does.
  • Name the sources when there are any. Showing where it came from is how a reader decides whether to trust it.

Don't

  • Don't put it inside a <label>. A button inside a label is read into the field's name; put it beside the label.
  • Don't mark everything. A label on every line is a label on nothing.
  • Don't rely on the colour. The words say AI; ai.text only helps you find them.