---
title: "AI Elements"
description: "Patterns for agentic interfaces, composed from rightui components."
---

# AI Elements

Patterns for agentic interfaces, composed from rightui components.

## Built from shared components

Copy a pattern into your Exact project and adapt its state and actions. Trace, Message, Code Block and the other rightui primitives provide the common structure. These demos use local sample data; connect your own model and tools in your data module.

## Demo runtime

Timed examples use an injected clock. Add these members to your root component. Replace the scripted state with events from your TypeScript or Rust data source when connecting a model.

```contract
use defaultFontWeights from "@rightui/ui"
  state demoTime = 0
  state demoUntil = 0
  provide
    uiFont = "theme"
    uiWeights = defaultFontWeights()
    rightuiDemoTime = demoTime
    rightuiRunDemo = runDemo
  action runDemo(duration: number)
    demoUntil = max(demoUntil, demoTime + duration)
  action tickDemo
    demoTime = min(demoUntil, demoTime + 32)
  task demoClock when demoTime < demoUntil
    every(32, tickDemo)
```

## Patterns

- [Chain of Thought](/docs/ai-elements/chain-of-thought.md): An expandable summary of observable agent steps.
- [Chat](/docs/ai-elements/chat.md): A local conversation with an editable prompt and response actions.
- [Checkpoint](/docs/ai-elements/checkpoint.md): Restore a saved point in a local conversation.
- [Confirmation](/docs/ai-elements/confirmation.md): Review a proposed action and explicitly approve or deny it.
- [Context](/docs/ai-elements/context.md): Inspect a conversation token budget.
- [File Tree](/docs/ai-elements/file-tree.md): Explore collapsible folders and inspect a selected file.
- [Inline Citation](/docs/ai-elements/inline-citation.md): An inline source reference with a hover and focus card.
- [Message](/docs/ai-elements/message.md): One turn, with a user bubble, Markdown reply and response actions.
- [Model Selector](/docs/ai-elements/model-selector.md): Choose a sample model and a reasoning effort independently.
- [Plan](/docs/ai-elements/plan.md): Track a predefined plan and its completion count.
- [Prompt Input](/docs/ai-elements/prompt-input.md): Compose a message with attachments and a send button.
- [Queue](/docs/ai-elements/queue.md): Separate remaining work from completed items.
- [Reasoning](/docs/ai-elements/reasoning.md): Stream a reasoning summary, expand its details and replay the response.
- [Sources](/docs/ai-elements/sources.md): Expand the source list and follow the original documentation links.
- [Stack Trace](/docs/ai-elements/stack-trace.md): Inspect an error and expand its stack frames.
- [Subagent](/docs/ai-elements/subagent.md): Inspect a delegated task, its sample tool calls and result.
- [Suggestion](/docs/ai-elements/suggestion.md): Choose a prompt suggestion and inspect the selected local prompt.
- [Task](/docs/ai-elements/task.md): Follow steps discovered as work progresses.
- [Terminal](/docs/ai-elements/terminal.md): Reveal sample command output one chunk at a time.
- [Test Results](/docs/ai-elements/test-results.md): Inspect suites, test statuses and failure details.
- [Tool](/docs/ai-elements/tool.md): Inspect a tool call with structured input and output.
