AI Primitives

Component library

Building blocks for AI chat interfaces.

Messages, a composer, reasoning, tool calls and streaming content - accessible React components you install with the shadcn CLI and own as source code.

Installation guide · Open the Playground

Primitives

  • Button - Core button with six variants and sizes down to icon-only.
  • Copy Button - Icon button that copies text to the clipboard and confirms with a checkmark.
  • Code Block - Syntax-highlighted code block with a language label and a built-in copy button.
  • Dialog - A modal for focused tasks and confirmations - centered on larger screens, a bottom sheet on phones.
  • Dropdown Menu - Menus with actions, radio and checkbox items, shortcuts and destructive states.
  • Tooltip - Labels for icon-only controls, with shared delays so a row of buttons reads quickly.
  • Switch - An on/off toggle for settings that take effect immediately.
  • Tabs - Switch between related views with a segmented tab list.
  • Segmented Control - A compact single-choice control for modes and filters - it can never be left empty.

Feedback

  • Skeleton - Quiet placeholders in the shape of the content that's loading.
  • Loader - Twelve loading-indicator styles - spinners, dots, bars, and shimmer text.
  • Text Shimmer - A shimmering gradient sweep across text, for a "thinking" state.
  • Thinking Bar - A shimmering status row with an optional expand action and a stop button.
  • Feedback Bar - A thumbs up / thumbs down row for rating an AI response.
  • System Message - Action, warning, and error banners with an optional icon and call-to-action.

Chat

  • Chat Bubble - Message bubble primitives - avatars, filled/no-background appearances, timestamps, and actions.
  • Prompt Input - Auto-resizing chat input with attachments, an action menu, and a compact pill mode.
  • Chat Demo - A full conversation - chat bubbles, prompt input, and a dummy AI reply wired together.
  • Chat Container - Auto-scrolling chat viewport that sticks to the bottom as messages stream in.

Prompt

  • Prompt Suggestion - Suggested-prompt pills, or a highlighted-match list for autocomplete.

Reasoning

  • Reasoning - A collapsible "thinking" block that auto-opens while streaming and closes when done.
  • Chain of Thought - A vertical trail of collapsible reasoning steps, connected by a line.
  • Steps - A collapsible, numbered list of completed steps with a side rail.
  • Tool - A collapsible tool-call card showing its state, input, output, or error.
  • Source - An inline citation chip that opens a hover card with the linked page's details.

Content

  • Markdown - Streaming-safe markdown renderer with GFM support and code blocks built in.
  • Response Stream - Animates text in token-by-token (typewriter) or word-by-word (fade).
  • JSX Preview - Renders a JSX string as live output, auto-closing open tags mid-stream.
  • Image - Displays a URL, base64, or raw-bytes image, with an animated placeholder while pending.
  • File Upload - A drag-and-drop dropzone that overlays the whole page while a file is dragged over it.