Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. AI
  4. AI response parts

AI

AI response parts

What goes around an answer: the reasoning behind it, the tools an agent ran, the sources it used with inline citations, and actions to copy, regenerate and rate it.

import { ResponseActions, Reasoning, ToolCall, Sources, Citation } from '@alea/ui';

Examples

An answer

Reasoning folded away with how long it took, inline citations, the sources and the actions. Rate it, copy it or open the reasoning.

Pass your accent to brandVariables and put the result on the root1. Every semantic token follows, in dark, light and high contrast2, and the Figma kit uses the same variables3.

Sources

  1. Themingalea.alevasquez.devbrandVariables turns an accent, a radius and a density into a theme.
  2. Colorsalea.alevasquez.devSemantic tokens for dark, light and high contrast.
  3. Figma kitalea.alevasquez.devThe same tokens as Figma variables.

Agent steps

Tool calls as an agent works through them: each one runs, then finishes or fails, and its status is announced. Open a step to see what went in and what came back.

Read the brief: Done
Search the web: Failed
Write the plan: Done

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-accent-strong…
  • --alea-accent-subtle…
  • --alea-status-success…
  • --alea-surface-hover…
  • --alea-text…
  • --alea-text-muted…

Radius

  • --alea-radius-sm…

Motion

  • --alea-motion-duration-fast…
  • --alea-motion-ease-out…
  • --alea-motion-scale-press…

Props

ResponseActions props

The row under an answer: copy (it confirms), regenerate, and good or bad feedback as toggle buttons.

PropTypeDefaultDescription
classNamestring-Extra class names.
copyTextstring-The text Copy puts on the clipboard. Leave out to hide Copy.
extraReactNode-More buttons at the end: share, read aloud.
feedback"good" | "bad" | null-The current feedback (controlled).
onFeedback((value: "good" | "bad" | null) => void)-Shows the thumbs; called with the choice (null when taken back).
onRegenerate(() => void)-Shows Regenerate.

Reasoning props

The model's thinking, behind a disclosure: "Thinking…" shimmers while it works, then "Thought for 4 s" and it folds away.

PropTypeDefaultDescription
childrenrequiredReactNode-The model's reasoning, as text or nodes.
classNamestring-Extra class names.
defaultOpenboolean-Open at first. Default: open while thinking, closed after.
isThinkingboolean-Still thinking: the label shimmers and the panel stays open.
secondsnumber-How long it thought, in seconds, shown when done.

ToolCall props

One step of an agent: the tool, its status (running spins, done checks, error warns) and, on demand, what went in and what came back. Status changes are announced.

PropTypeDefaultDescription
namerequiredstring-The tool's name: "Search the web".
statusrequired"running" | "done" | "error"-running, done or error.
classNamestring-Extra class names.
iconReactNode-An icon for the tool.
inputReactNode-What was sent to the tool, shown when expanded.
outputReactNode-What came back, shown when expanded.
summaryReactNode-A short line: the query, the file.

Sources props

The sources behind an answer, numbered to match the citations in the text, each a link with its site.

PropTypeDefaultDescription
sourcesrequiredSource[]-
classNamestring-Extra class names.

Citation props

An inline citation: a small number that links to its source and is named with the source's title.

PropTypeDefaultDescription
nrequirednumber-The number shown, matching Sources.
sourcerequiredSource-The source it points to.
classNamestring-Extra class names.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

ResponseActions

Variants
feedbackgoodbadnull
States
Hover (CSS)Pressed (CSS)Disabled
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-response-actions.alea-prompt-btn
Data attributes
data-done

Reasoning

States
Hover (CSS)Open
Motion
streamroute
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-reasoning.alea-reasoning-toggle.alea-reasoning-icon.alea-text-shimmer.alea-reasoning-chevron.alea-reasoning-panel.alea-reasoning-body
Data attributes
data-thinking

ToolCall

Variants
statusrunningdoneerror
States
OpenHover (CSS)
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-tool-icon.alea-tool-text.alea-tool-name.alea-tool-summary.alea-tool-status.alea-reasoning-chevron.alea-tool.alea-tool-head.alea-tool-panel.alea-tool-label.alea-tool-code
Data attributes
data-status=runningdata-status=donedata-status=error

Sources

States
Hover (CSS)
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-sources.alea-sources-title.alea-sources-list.alea-source.alea-source-n.alea-source-text.alea-source-title.alea-source-host.alea-source-snippet

Citation

States
Hover (CSS)
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-citation

Accessibility

  • Reasoning and ToolCall are disclosure buttons (aria-expanded) with their panels; Thinking shimmers but its text is plain for screen readers.
  • A tool call announces its status as it changes (running, done, failed), and the status is a word, not only an icon color.
  • Citations are links named Source 1: and the title, so they make sense out of context; Sources is a labelled region with a numbered list.
  • Good and bad are toggle buttons (aria-pressed); copying and feedback are confirmed in a polite announcement.

Keyboard

KeyDoes
TabMoves through the toggles, citations, sources and actions
Enter or SpaceOpens or closes reasoning and tool details; presses an action

Do and don't

Do

  • Fold reasoning away once the answer is ready: it is there for people who want it.
  • Number citations in the order sources appear in the list.
  • Give each tool a name people understand: Search the web, not web_search_v2.

Don't

  • Don't hide that an answer used tools or sources.
  • Don't ask for feedback on every message with a dialog: the thumbs are enough.

In Figma

ResponseActions, Reasoning (Thinking, Done, Open), ToolCall (Running, Done, Error, Open), Sources and Citation.

Tested with axe, keyboard and screen reader roles