# AI components

`@vite-hub/ui` gives you the Vue and Nuxt components of the ViteHub Console. They are built on Nuxt UI. Start with a full Console block, then connect your data.

The package draws the UI. Your app sends and stores data and checks access. Every example uses fake data, makes no network requests, and shows its source below.

## A Console with the defaults

Select a session to read and reply. This example uses the default styles and layouts.

_Interactive preview available on the rendered documentation page._


[Install the package](https://vitehub.dev/docs/ui/installation) and copy the [Chat app](https://vitehub.dev/docs/ui/blocks/chat-app), [Code review](https://vitehub.dev/docs/ui/blocks/code-review), or [Collaborative editor](https://vitehub.dev/docs/ui/blocks/collaborative-editor) into your app. Each block shows how to connect real data.

## Components

- **Console:** [Chat app](https://vitehub.dev/docs/ui/blocks/chat-app), [Code review](https://vitehub.dev/docs/ui/blocks/code-review), [Collaborative editor](https://vitehub.dev/docs/ui/blocks/collaborative-editor)
- **Parts:** [Message](https://vitehub.dev/docs/ui/message), [Bubble](https://vitehub.dev/docs/ui/bubble), [Marker](https://vitehub.dev/docs/ui/marker), [Attachment](https://vitehub.dev/docs/ui/attachment), [Trace](https://vitehub.dev/docs/ui/trace), [Code block](https://vitehub.dev/docs/ui/code-block), [Copy button](https://vitehub.dev/docs/ui/copy-button), [Status](https://vitehub.dev/docs/ui/status), [Relative time](https://vitehub.dev/docs/ui/relative-time)
- **Chat:** [Chat](https://vitehub.dev/docs/ui/chat), [Chat message](https://vitehub.dev/docs/ui/chat-message), [Message parts](https://vitehub.dev/docs/ui/message-parts), [Markdown](https://vitehub.dev/docs/ui/markdown), [Markdown Editor](https://vitehub.dev/docs/ui/markdown-editor), [Prompt input](https://vitehub.dev/docs/ui/prompt-input), [Filter search](https://vitehub.dev/docs/ui/filter-search), [Chat session](https://vitehub.dev/docs/ui/chat-session), [Agent session](https://vitehub.dev/docs/ui/agent-session)
- **Collaboration:** [Comments](https://vitehub.dev/docs/ui/comments), [Avatar stack](https://vitehub.dev/docs/ui/avatar-stack), [Connection status](https://vitehub.dev/docs/ui/connection-status), [Sync status](https://vitehub.dev/docs/ui/sync-status), [Carets](https://vitehub.dev/docs/ui/carets)
- **Agent work:** [Tool list](https://vitehub.dev/docs/ui/tool-list), [Diff](https://vitehub.dev/docs/ui/diff), [Code view](https://vitehub.dev/docs/ui/code-view), [File tree](https://vitehub.dev/docs/ui/file-tree), [Device frame](https://vitehub.dev/docs/ui/device-frame), [Playground render](https://vitehub.dev/docs/ui/playground-render)
- **Utilities:** [Attachments](https://vitehub.dev/docs/ui/attachments), [Message scroller](https://vitehub.dev/docs/ui/message-scroller)

## What each layer owns

| Concern | Owner |
| ------- | ----- |
| Message contracts and transport | AI SDK or your ViteHub Agent route |
| Scroll intent and message jumps | ViteHub headless Vue primitives |
| Tokens and basic controls | Nuxt UI |
| Chat, sessions, Agent views, Markdown, attachments | ViteHub UI |
| Diffs and path-first file trees | Pierre |

The package does not send messages. Use `useChat()` from `@ai-sdk/vue` or from `vite-hub/agent/vue`, then pass its values to the components.

## Entry points

| Import                    | Use it for                                                                     |
| ------------------------- | ------------------------------------------------------------------------------ |
| `vite-hub/ui`             | Styled components, composables, and display and Pierre diff helpers. |
| `vite-hub/ui/headless`   | Message scroller and Choices input parts, without styles or Nuxt UI. |
| `vite-hub/ui/markdown-editor` | `MarkdownEditor`. It has its own entry, so pages without it never load Tiptap. |
| `vite-hub/ui/workspace` | The live app parts and `PlaygroundContainer` for tutorials and playgrounds. It has its own entry, so pages without it never load CodeMirror or xterm. |
| `vite-hub/ui/playground` | Share links and zips for a playground, with no UI. They run in Node too. |
| `vite-hub/ui/theme` and `vite-hub/ui/theme.css` | `vitehubTheme`, the Nuxt UI app config, and the design tokens. Import the theme from `nuxt.config`. |
| `vite-hub/ui/vite`       | Vite plugin for Vue apps. Configures Nuxt UI and Comark. |
| `vite-hub/ui/styles.css` | Stylesheet. Load it after Tailwind CSS and Nuxt UI. |

Each `vite-hub/ui/*` path re-exports the same path of `@vite-hub/ui`.

## Use without ViteHub

The components also work in a Vue app without `vite-hub`. Install `@vite-hub/ui` and import every path from it, such as `@vite-hub/ui/vite` and `@vite-hub/ui/styles.css`:

```bash pm [commands/install-alone]
pnpm add @vite-hub/ui @nuxt/ui ai tailwindcss vue
```

```vue [alone/src/components/Example.vue]
<script setup lang="ts">
import { Markdown } from "@vite-hub/ui";
</script>

<template>
  <Markdown value="**ViteHub UI is ready.**" />
</template>
```

In Nuxt, the components get their runtime from `vite-hub/nuxt`, so a Nuxt app installs `vite-hub`.

<!-- vitehub-docs:section-links -->
## In this section

- [Start](https://vitehub.dev/raw/docs/ui.md)
- AI components
  - [AI components](https://vitehub.dev/raw/docs/ui/ai-components.md) (this page)
  - [Installation](https://vitehub.dev/raw/docs/ui/installation.md)
  - [Chat tutorial](https://vitehub.dev/raw/docs/ui/chat-tutorial.md)
- [Blocks](https://vitehub.dev/raw/docs/ui/blocks/chat-app.md)
- [Parts](https://vitehub.dev/raw/docs/ui/message.md)
- [Chat](https://vitehub.dev/raw/docs/ui/chat.md)
- [Collaboration](https://vitehub.dev/raw/docs/ui/avatar-stack.md)
- [Agent work](https://vitehub.dev/raw/docs/ui/tool-list.md)
- [Utilities](https://vitehub.dev/raw/docs/ui/attachments.md)

Next: [UI_RELATIVE_TIME_THRESHOLD_INVALID](https://vitehub.dev/raw/docs/ui/diagnostics/ui_relative_time_threshold_invalid.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
