Skip to content
Back to search

agent-elements

Production-ready React components for chat, tools, and AI workflows.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/21st-dev--agent-elements/badge.svg)](/listings/21st-dev--agent-elements)

HTML

<a href="/listings/21st-dev--agent-elements"><img src="/api/listings/21st-dev--agent-elements/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

The registry is shadcn-compatible. Pull in `agent-chat` and it transitively installs everything it needs:

npx shadcn@latest add https://agent-elements.21st.dev/r/agent-chat.json

Files land under `components/agent-elements/`. Pick individual pieces the same way:

npx shadcn@latest add https://agent-elements.21st.dev/r/bash-tool.json
npx shadcn@latest add https://agent-elements.21st.dev/r/input-bar.json

**Requirements:** React 19, Tailwind v4, a shadcn-initialised project (`npx shadcn@latest init`).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 137 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. # Agent Elements
  3. **Production-ready React components for chat, tools, and AI workflows.**
  4. A shadcn-style registry of agent UI primitives — message lists, streaming markdown, tool cards (Bash, Edit, Search, Todo, Plan…), clarifying questions, and a composable input bar — built on React 19, Tailwind v4, and the Vercel AI SDK.
  5. [Live site](https://agent-elements.21st.dev) · [Docs](https://agent-elements.21st.dev/docs) · [Discord](https://discord.gg/Aq2B7bCp) · [21st.dev](https://21st.dev)
  6. </div>
  7. ---
  8. ## What's in the box
  9. - **`AgentChat`** — drop-in chat shell that wires `MessageList` + `InputBar`, dispatches tool invocations to renderers, and handles the empty state.
  10. - **Tool cards** — `BashTool`, `EditTool` (with diffs + approval), `SearchTool`, `TodoTool`, `PlanTool`, `ToolGroup`, `SubagentTool`, `McpTool`, `ThinkingTool`, `GenericTool`.
  11. - **Question tool** — clarifying questions with single / multi / free-text answers.
  12. - **Composer pieces** — `InputBar`, `Suggestions`, `ModelPicker`, `ModeSelector`, `SendButton`, `AttachmentButton`, `FileAttachment`.
  13. - **Streaming bits** — `Markdown` (safe streaming), `TextShimmer`, `SpiralLoader`.
  14. 26 components total — see the full catalog at [agent-elements.21st.dev/docs](https://agent-elements.21st.dev/docs) or the registry index at [`/r/index.json`](https://agent-elements.21st.dev/r/index.json).
  15. ## Install components
  16. The registry is shadcn-compatible. Pull in `agent-chat` and it transitively installs everything it needs:
  17. ```bash
  18. npx shadcn@latest add https://agent-elements.21st.dev/r/agent-chat.json
  19. ```
  20. Files land under `components/agent-elements/`. Pick individual pieces the same way:
  21. ```bash
  22. npx shadcn@latest add https://agent-elements.21st.dev/r/bash-tool.json
  23. npx shadcn@latest add https://agent-elements.21st.dev/r/input-bar.json
  24. ```
  25. **Requirements:** React 19, Tailwind v4, a shadcn-initialised project (`npx shadcn@latest init`).
  26. ## Quick example
  27. ```tsx
  28. "use client";
  29. import { AgentChat } from "@/components/agent-elements/agent-chat";
  30. import { BashTool } from "@/components/agent-elements/tools/bash-tool";
  31. import { EditTool } from "@/components/agent-elements/tools/edit-tool";
  32. import { SearchTool } from "@/components/agent-elements/tools/search-tool";
  33. import { useChat } from "@ai-sdk/react";
  34. export default function Chat() {
  35. const { messages, status, sendMessage, stop } = useChat();
  36. return (
  37. <AgentChat
  38. messages={messages}
  39. status={status}
  40. onSend={({ content }) => sendMessage({ text: content })}
  41. onStop={stop}
  42. toolRenderers={{
  43. Bash: BashTool,
  44. Edit: EditTool,
  45. Write: EditTool,
  46. Search: SearchTool,
  47. }}
  48. />
  49. );
  50. }
  51. ```
  52. ## Skill for Claude Code & friends
  53. A bundled [skills.sh](https://skills.sh) skill teaches AI assistants the component catalog, prop shapes, and composition rules so they stop hallucinating imports.
  54. ```bash
  55. npx skills add 21st-dev/agent-elements
  56. ```
  57. Source: [`skills/agent-elements/SKILL.md`](skills/agent-elements/SKILL.md). More at [docs/skills](https://agent-elements.21st.dev/docs/skills).
  58. ## Local development
  59. This repo is **both** the registry source and the documentation site (Next.js 16). To run it:
  60. ```bash
  61. pnpm install
  62. pnpm dev # http://localhost:3000
  63. ```
  64. Other scripts:
  65. | Script | What it does |
  66. | ------------------------ | ----------------------------------------------------------- |
  67. | `pnpm dev` | Next.js dev server |
  68. | `pnpm build` | Rebuilds the registry, then builds the site (`prebuild` hook) |
  69. | `pnpm registry:build` | Generates `public/r/*.json` from `lib/agent-ui/` |
  70. | `pnpm lint` / `pnpm format` | ESLint / Prettier |
  71. ## Project structure
  72. ```
  73. .
  74. ├── app/ Next.js app — landing page, /docs, /api/agent
  75. ├── lib/agent-ui/ Component source (the library)
  76. ├── scripts/build-registry.mts Compiles lib/agent-ui → public/r/*.json
  77. ├── public/r/ Generated shadcn registry (committed)
  78. ├── skills/agent-elements/ skills.sh bundle (SKILL.md + README)
  79. └── agents/my-agent/ Example @21st-sdk/agent definition
  80. ```
  81. The registry builder resolves intra-library imports, rewrites `@/lib/agent-ui/*` → `@/components/agent-elements/*`, and emits one JSON per component plus an index.
  82. ## Part of the 21st.dev Agent SDK
  83. Agent Elements is the UI layer of the [**21st.dev Agent SDK**](https://21st.dev/agents). If you just want the components, everything above works on its own — plug them into any React app and wire them to your backend.
  84. If you need a full agent (Claude Code or Codex running in a sandbox, with threads, streaming, tool approvals, and this UI out of the box), use the SDK directly. You get the same components, preconfigured, plus the runtime.
  85. → [Explore the Agent SDK](https://21st.dev/agents)
  86. ## Stack
  87. Next.js 16 · React 19 · Tailwind v4 · [Vercel AI SDK](https://sdk.vercel.ai) · [shadcn](https://ui.shadcn.com) · [Base UI](https://base-ui.com) · [Motion](https://motion.dev) · [Shiki](https://shiki.style) · [`@21st-sdk/*`](https://21st.dev/agents)
  88. ## Links
  89. - **Site:** [agent-elements.21st.dev](https://agent-elements.21st.dev)
  90. - **Registry index:** [agent-elements.21st.dev/r/index.json](https://agent-elements.21st.dev/r/index.json)
  91. - **LLM-friendly docs:** [agent-elements.21st.dev/llms-full.txt](https://agent-elements.21st.dev/llms-full.txt)
  92. - **Issues:** [github.com/21st-dev/agent-elements/issues](https://github.com/21st-dev/agent-elements/issues)
  93. - **Discord:** [discord.gg/Aq2B7bCp](https://discord.gg/Aq2B7bCp)
  94. ## License
  95. [MIT](LICENSE) — built by [21st.dev](https://21st.dev).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.