# 开始使用

粘贴一段提示词到智能体里即可完成配置，然后选择下一步。

UI SDK 是一个行为库，提供浮层、列表和键入查找（typeahead）等行为，由你的智能体把它们组合成组件。它可以和 React、Vue、Svelte、Solid 和 Web Components 一起使用。

第一次来？[简介](/docs/core)说明了这一切是如何运作的。

## 快速开始
选择你的框架，然后把这段提示词复制到你的智能体里。

**React**

```text prompt
Set up ui-sdk in this React project. It needs React 19 or newer.

1. Install @ui-sdk/react and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/react/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/react/docs/core.md by heading, and read rendering.md next to it.
3. If you support skills, run: npx skills@latest add vercel-labs/ui --skill ui-sdk
```

**Vue**

```text prompt
Set up ui-sdk in this Vue project. It needs Vue 3.5 or newer.

1. Install @ui-sdk/vue and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. If it's a Nuxt 4 or newer app, add "@ui-sdk/vue" to modules in nuxt.config.ts.
3. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/vue/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/vue/docs/core.md by heading, and read rendering.md next to it.
4. If you support skills, run: npx skills@latest add vercel-labs/ui --skill ui-sdk
```

**Svelte**

```text prompt
Set up ui-sdk in this Svelte project. It needs Svelte 5.33 or newer.

1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/svelte/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/svelte/docs/core.md by heading, and read rendering.md next to it.
3. If you support skills, run: npx skills@latest add vercel-labs/ui --skill ui-sdk
```

**Solid**

```text prompt
Set up ui-sdk in this Solid project. It needs Solid 2: solid-js and @solidjs/web 2.0.0 or newer.

1. Install @ui-sdk/solid and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/solid/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/solid/docs/core.md by heading, and read rendering.md next to it.
3. If you support skills, run: npx skills@latest add vercel-labs/ui --skill ui-sdk
```

**Web Components**

```text prompt
Set up ui-sdk in this Web Components project. Each component registers its tags when you import its entry, like @ui-sdk/web/dialog.

1. Install @ui-sdk/web and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/web/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/web/docs/core.md by heading, and read rendering.md next to it.
3. If you support skills, run: npx skills@latest add vercel-labs/ui --skill ui-sdk
```

然后让你的智能体构建一个组件：

```text prompt
Build a search field with ui-sdk: a text input and a Clear button that only shows when there's text. Clear empties the input and puts focus back in it. Use our existing styles.
```

## 找到组件
- [Select](/docs/components/select): 选择浮层列表中的一个或多个值。
- [Field](/docs/components/field): 把表单控件连接到它的标签、描述和校验错误。
- [Tabs](/docs/components/tabs): 切换多个相关面板，同一时间只选中一个选项卡。
- [Combobox](/docs/components/combobox): 搜索选项列表，选择一个或多个值。
- [Date Picker](/docs/components/date-picker): 输入日期，或从日历中选择，支持范围和表单。
- [Menu](/docs/components/menu): 选择按钮或上下文菜单中的操作和设置。

或者[查看所有组件](/docs/components)。

## 自己构建
- [Core](/docs/core): 各种行为，以及它们如何组合在一起。
- [构建一个组件](/docs/core/build-a-component): 做一个开关按钮，然后在你的框架里渲染它。
- [行为](/docs/core/behaviors): 焦点、选择、浮层，以及组成组件的其他片段。
- [组合行为](/docs/core/compose-behaviors): 用共享状态和键盘导航构建一个星级评分。

## 与智能体协作
- [用智能体构建](/docs/agents/build-with-an-agent): 给智能体合适的上下文，构建一个小版本，再检查它的行为。
- [Skills](/docs/agents/skills): 帮助你的智能体用 @ui-sdk/core 构建自定义组件。
- [连接智能体](/docs/agents/connect-an-agent): 让智能体读取你的组件并调用它们的动作。
- [WebMCP](/docs/agents/connect-an-agent/webmcp): 让浏览器内置的智能体读取并使用你的组件。

看看[更新日志](/docs/core/changelog)里有哪些新内容。
