Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Blocks
  2. Ai Elements
  3. Accessibility

AI Elements

Accessibility

Chat

Chat is a transcript region plus a composer. The root exposes data-slot="chat", data-variant for the active form factor, and data-composer (floating / docked). Turns render as data-slot="message" with data-role; the composer is data-slot="prompt-input". When floating, the composer wrapper is data-slot="chat-composer".

What the component handles

  • Scroll-to-latest is an accessible control; pass scrollToLatestLabel for a localized name.
  • Composer submit and attach controls take submitLabel / addLabel (English defaults in the package).
  • Empty transcripts with emptyState render that copy in the transcript region; without emptyState, Default docks the composer in flow until the first turn so content-sized hosts still expose the Reply field.
  • In the Default (floating) form factor, the transcript reserves the measured composer height so no turn is permanently obscured behind the scrim, and the scroll-to-latest control lifts above the composer.

What you must provide

  • Localized strings for scrollToLatestLabel, composer placeholder / submitLabel, and emptyState when embedding in a product that requires i18n.
  • Meaningful author.name values (also used for avatar alt text).
  • Surrounding context when multiple chats appear so screen reader users know which thread they are in.

Not yet handled

  • Transcript region semantics (role="log" / aria-live) for streaming turns — data-slot attributes are styling and test selectors only.
  • An accessible name on the chat root when multiple chats share a page.

Keyboard behavior

  • Tab / Shift+Tab: move through scroll affordance (when visible) and composer controls.
  • Enter in the composer submits (Shift+Enter inserts a newline where the editable supports it).

CodeBlock

CodeBlock is a read-only code surface. Structure comes from a bordered container, a header with the language label and optional copy control, and a body that shows either plain <pre><code> (while highlighting loads or on failure) or Shiki-generated HTML.

What the component handles

  • Copy control is an IconButton with a clear title (Copy code / Copied).
  • Language is exposed as visible text in the header (defaults to text).
  • Fallback and loading states keep the raw source in the DOM so assistive tech can still read the code before tokens paint.
  • Syntax colors are decorative; meaning does not depend on token hue alone.

What you must provide

  • Localized copy titles when embedding in a product that requires i18n for control labels (the package currently uses English titles on the button).
  • Surrounding context when multiple blocks appear (e.g. associate with a tool name or message role) so screen reader users know which snippet they are copying.

Keyboard behavior

  • Tab / Shift+Tab: move to the copy control when showCopy is true.
  • Enter or Space: activate copy when the control is focused.

Semantics and roles

  • Prefer the native <pre> / <code> fallback path for linear reading; Shiki output also emits pre/code.
  • Do not wrap the block in an extra role="button" or make the entire surface clickable for copy—use the dedicated control.

Shimmer

Shimmer is a purely visual in-progress treatment around a text label. The optional leading icon is decorative (aria-hidden); the label text is the meaningful content assistive tech should read.

What the component handles

  • The icon mounts without an accessible name so screen readers announce only the label.
  • Under prefers-reduced-motion, animation is disabled and both text and icon fall back to static --color-text-alt.

What you must provide

  • A concise label that stands on its own without relying on the icon (e.g. "Thinking…" rather than relying on a sparkle glyph to convey state).
  • Surrounding context when multiple shimmer labels appear so screen reader users know which process is in progress.

Previous

AI Elements / API and Development

Next

Data Table / Usage

On this page

Chat
What the component handles
What you must provide
Not yet handled
Keyboard behavior
CodeBlock
What the component handles
What you must provide
Keyboard behavior
Semantics and roles
Shimmer
What the component handles
What you must provide