使用无样式的自定义元素,键盘、焦点和屏幕阅读器支持已经内置。

这些文档介绍 ui-sdk 在 Web Components 里的用法。用的是其他框架?请看 React、Vue、Svelte 或 Solid。想从行为出发构建自己的组件,请看 Core。

@ui-sdk/web 以自定义元素(custom elements)的形式提供 Select、Dialog、Tabs 等组件,它们都构建在 ui-sdk 的行为之上。这些组件处理交互、焦点和 ARIA 属性。HTML 和样式由你来写。

导入你需要的组件以注册它们的标签,把它们加到页面上,再用自己的 CSS 设置样式。

快速开始

把这段提示词复制到你的智能体里:

提示词
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

它会安装 ui-sdk,并让你的 AGENTS.md 指向随包发布的文档。

自己配置

探索组件

使用组件指南 介绍这些组件共有的模式,比如组合部件、处理状态和设置样式。