TDesign Vue Next
S - Scope
- Target:
tdesign-vue-next@^1 with Vue 3.3+
- Cover: Basic components, layout components, navigation components, input components, data display components, feedback components, theme customization, dark mode, Chat component
- Avoid: Undocumented internal APIs, DOM manipulation hacks, other TDesign tech stacks (React/Miniprogram)
Default assumptions (when not explicitly specified)
- Language: TypeScript +
<script setup> syntax
- Styling: Use CSS variables and
ConfigProvider for theme configuration, avoid directly overriding internal component class names
- Provider: Use a single
ConfigProvider at the app root for unified configuration
- Icons: Use
tdesign-icons-vue-next icon library
- Imports: Import components on demand
import { Button } from 'tdesign-vue-next'
Scope rules (must follow)
- Only use APIs documented in TDesign official documentation
- Do not invent props, events, or component names
- Never use
@ts-ignore to bypass type checking; consult official type definitions first for type issues
- If encountering potential bugs or documentation-behavior inconsistencies, clearly inform users and guide them to submit an Issue
- Example code must be directly runnable, no pseudo-code or ellipsis placeholders
Complex triggers (must open corresponding Reference)
| Trigger Condition |
Reference |
Dynamic forms (FormItem add/remove), cross-field validation, async validation |
references/form-advanced.md |
| Server-side sorting/filtering/pagination, virtual scroll, editable table, tree table |
references/table-advanced.md |
| Remote search, large datasets, paginated loading, custom rendering |
references/select-advanced.md |
| Controlled file list, resumable upload, custom upload request |
references/upload-advanced.md |
| Async node loading, checkStrictly, virtual scroll |
references/tree-advanced.md |
| Async loading, dynamic options, custom panel |
references/cascader-advanced.md |
| Dialog/Drawer nesting, imperative calls, close interception |
references/dialog-drawer-advanced.md |
| Deep theme customization, dynamic theme switching, component-level style override |
references/theming-advanced.md |
| Dark mode toggle, system preference sync, local dark mode |
references/dark-mode.md |
| AI chat component, streaming response, custom message rendering |
references/chat-advanced.md |
| TDesign Vue Next 1.x version differences, upgrade guide |
references/tdesign-v1.md |
Reference index
| Topic |
Description |
Reference |
| Version Reference |
1.x version scope, upgrade notes |
references/tdesign-v1.md |
| Form Advanced |
Dynamic forms, linked validation, async validation |
references/form-advanced.md |
| Table Advanced |
Virtual scroll, server-side data, editable cells |
references/table-advanced.md |
| Select Advanced |
Remote search, pagination, custom options |
references/select-advanced.md |
| Upload Advanced |
Controlled upload, custom request, resumable upload |
references/upload-advanced.md |
| Tree Advanced |
Async loading, checkStrictly, virtual scroll |
references/tree-advanced.md |
| Cascader Advanced |
Async loading, dynamic panel |
references/cascader-advanced.md |
| Dialog/Drawer Advanced |
Nested layers, imperative calls |
references/dialog-drawer-advanced.md |
| Theme Customization |
CSS variables, Design Token, dynamic theme |
references/theming-advanced.md |
| Dark Mode |
Mode toggle, system preference, local dark mode |
references/dark-mode.md |
| Chat Component |
AI chat, streaming response, message rendering |
references/chat-advanced.md |
P - Process
1) Identify component hierarchy
User requirements
├── Basic display → Button / Link / Icon / Typography
├── Layout structure → Layout / Grid / Space / Divider
├── Navigation interaction → Menu / Tabs / Breadcrumb / Steps / Pagination
├── Data input → Form / Input / Select / DatePicker / Upload / ...
├── Data display → Table / List / Tree / Card / Descriptions / ...
├── Feedback → Message / Notification / Dialog / Drawer / Loading
└── Advanced scenarios → Chat (AI conversation)
2) Clarify context before making suggestions
Before providing component recommendations, confirm:
- Vue version (3.3+ recommended)
- Whether
ConfigProvider is configured
- Whether dark mode support is needed
- Whether there are special i18n requirements
- Data volume (affects whether virtual scroll is needed)
3) ConfigProvider configuration first
<template>
<ConfigProvider :global-config="globalConfig">
<App />
</ConfigProvider>
</template>
<script setup lang="ts">
import { ConfigProvider } from "tdesign-vue-next";
const globalConfig = {
// Global configuration
};
</script>
4) Component selection rules
| Scenario |
Recommended Component |
Notes |
| Simple list display |
List |
Small data, no complex interaction |
| Complex data table |
Table |
Supports sorting, filtering, pagination |
| Large data table |
Table + virtual-scroll |
Enable virtual scroll |
| Tree data selection |
TreeSelect |
Single/multiple tree selection |
| Cascading selection |
Cascader |
Multi-level linked selection |
| Simple dropdown |
Select |
Moderate number of options |
| Remote search select |
Select + filterable + remote |
Disable local filtering |
| File upload |
Upload |
Supports drag, multi-file |
| Form collection |
Form + FormItem |
Unified validation and submit |
| Light notification |
Message |
Operation feedback, auto-dismiss |
| Important notification |
Notification |
Requires user confirmation or contains actions |
| Confirmation action |
Dialog / Popconfirm |
Choose based on context |
| Side panel details |
Drawer |
Without interrupting page flow |
| AI conversation |
Chat |
Streaming messages, multi-turn dialogue |
5) Form decision chain
Need to collect user input?
├── Yes → Use Form wrapper
│ ├── Need dynamic add/remove fields? → See form-advanced.md
│ ├── Need cross-field linking? → See form-advanced.md
│ └── Simple form → Use FormItem + rules
└── No → Use input component directly
6) Table decision chain
Need to display list data?
├── Data > 1000 rows? → Enable virtual scroll, see table-advanced.md
├── Need server-side pagination/sorting? → See table-advanced.md
├── Need editable cells? → See table-advanced.md
└── Simple table → Use Table + columns + data
7) Theme customization decision chain
Need to customize theme?
├── Only modify brand color → ConfigProvider theme prop
├── Modify multiple tokens → Override CSS variables
├── Deep customization → See theming-advanced.md
└── Dark mode → See dark-mode.md
8) Route complex scenarios to Reference
When identifying trigger conditions from the Complex triggers table, must:
- Inform user this is a complex scenario
- Open the corresponding Reference document
- Provide suggestions based on recommended patterns in Reference
9) Accessibility and performance checks
- Ensure form controls have appropriate
label
- Enable virtual scroll or pagination for large data scenarios
- Avoid complex calculations in
template, use computed
- Ensure stable
key for list rendering
O - Output
Output should include (as needed)
- Component recommendation: Component name and selection rationale
- Minimal configuration: Required ConfigProvider setup
- Code example: Directly runnable
<script setup> code
- Performance tips: Notes for large data, frequent updates scenarios
- Reference path: Point to corresponding reference docs for complex scenarios
- Official documentation link: Related component's official documentation URL
Output forbidden
- Unverified APIs or props
- Hack code relying on specific internal implementations
- Incomplete code snippets (missing imports or key configurations)
- Code for other TDesign tech stacks (React/Miniprogram)
- Syntax incompatible with user's Vue version
Regression checklist
Quick Reference
Installation
npm install tdesign-vue-next
# Icon library
npm install tdesign-icons-vue-next
Full Import
// main.ts
import { createApp } from "vue";
import TDesign from "tdesign-vue-next";
import "tdesign-vue-next/es/style/index.css";
import App from "./App.vue";
createApp(App).use(TDesign).mount("#app");
On-demand Import (Recommended)
// main.ts
import { createApp } from "vue";
import { Button, Input, Form, FormItem } from "tdesign-vue-next";
import "tdesign-vue-next/es/style/index.css";
import App from "./App.vue";
const app = createApp(App);
app.use(Button).use(Input).use(Form).use(FormItem);
app.mount("#app");
Minimal Example
<template>
<ConfigProvider>
<Form :model="formData" :rules="rules" @submit="onSubmit">
<FormItem label="Username" name="username">
<Input v-model="formData.username" placeholder="Enter username" />
</FormItem>
<FormItem>
<Button theme="primary" type="submit">Submit</Button>
</FormItem>
</Form>
</ConfigProvider>
</template>
<script setup lang="ts">
import { reactive } from "vue";
import {
ConfigProvider,
Form,
FormItem,
Input,
Button,
} from "tdesign-vue-next";
import type { FormRules, SubmitContext } from "tdesign-vue-next";
const formData = reactive({
username: "",
});
const rules: FormRules<typeof formData> = {
username: [{ required: true, message: "Username is required" }],
};
const validateResult }: SubmitContext) => {
if (validateResult === true) {
console.log("Submit successful", formData);
}
};
</script>
Official Resources
1---2name: tdesign-vue-next3description: TDesign Vue 3 component library usage guide, covering tdesign-vue-next 1.x series, including basic components, forms, tables, theme customization, dark mode, and AI Chat components4---56# TDesign Vue Next78## S - Scope910- **Target**: `tdesign-vue-next@^1` with Vue 3.3+11- **Cover**: Basic components, layout components, navigation components, input components, data display components, feedback components, theme customization, dark mode, Chat component12- **Avoid**: Undocumented internal APIs, DOM manipulation hacks, other TDesign tech stacks (React/Miniprogram)1314### Default assumptions (when not explicitly specified)1516- **Language**: TypeScript + `<script setup>` syntax17- **Styling**: Use CSS variables and `ConfigProvider` for theme configuration, avoid directly overriding internal component class names18- **Provider**: Use a single `ConfigProvider` at the app root for unified configuration19- **Icons**: Use `tdesign-icons-vue-next` icon library20- **Imports**: Import components on demand `import { Button } from 'tdesign-vue-next'`2122### Scope rules (must follow)23241. Only use APIs documented in TDesign official documentation252. Do not invent props, events, or component names263. Never use `@ts-ignore` to bypass type checking; consult official type definitions first for type issues274. If encountering potential bugs or documentation-behavior inconsistencies, clearly inform users and guide them to submit an Issue285. Example code must be directly runnable, no pseudo-code or ellipsis placeholders2930### Complex triggers (must open corresponding `Reference`)3132| Trigger Condition | Reference |33| ------------------------------------------------------------------------------------ | -------------------------------------- |34| Dynamic forms (`FormItem` add/remove), cross-field validation, async validation | `references/form-advanced.md` |35| Server-side sorting/filtering/pagination, virtual scroll, editable table, tree table | `references/table-advanced.md` |36| Remote search, large datasets, paginated loading, custom rendering | `references/select-advanced.md` |37| Controlled file list, resumable upload, custom upload request | `references/upload-advanced.md` |38| Async node loading, checkStrictly, virtual scroll | `references/tree-advanced.md` |39| Async loading, dynamic options, custom panel | `references/cascader-advanced.md` |40| Dialog/Drawer nesting, imperative calls, close interception | `references/dialog-drawer-advanced.md` |41| Deep theme customization, dynamic theme switching, component-level style override | `references/theming-advanced.md` |42| Dark mode toggle, system preference sync, local dark mode | `references/dark-mode.md` |43| AI chat component, streaming response, custom message rendering | `references/chat-advanced.md` |44| TDesign Vue Next 1.x version differences, upgrade guide | `references/tdesign-v1.md` |4546### `Reference` index4748| Topic | Description | `Reference` |49| ---------------------- | --------------------------------------------------- | -------------------------------------- |50| Version Reference | 1.x version scope, upgrade notes | `references/tdesign-v1.md` |51| Form Advanced | Dynamic forms, linked validation, async validation | `references/form-advanced.md` |52| Table Advanced | Virtual scroll, server-side data, editable cells | `references/table-advanced.md` |53| Select Advanced | Remote search, pagination, custom options | `references/select-advanced.md` |54| Upload Advanced | Controlled upload, custom request, resumable upload | `references/upload-advanced.md` |55| Tree Advanced | Async loading, checkStrictly, virtual scroll | `references/tree-advanced.md` |56| Cascader Advanced | Async loading, dynamic panel | `references/cascader-advanced.md` |57| Dialog/Drawer Advanced | Nested layers, imperative calls | `references/dialog-drawer-advanced.md` |58| Theme Customization | CSS variables, Design Token, dynamic theme | `references/theming-advanced.md` |59| Dark Mode | Mode toggle, system preference, local dark mode | `references/dark-mode.md` |60| Chat Component | AI chat, streaming response, message rendering | `references/chat-advanced.md` |6162---6364## P - Process6566### 1) Identify component hierarchy6768```69User requirements70 ├── Basic display → Button / Link / Icon / Typography71 ├── Layout structure → Layout / Grid / Space / Divider72 ├── Navigation interaction → Menu / Tabs / Breadcrumb / Steps / Pagination73 ├── Data input → Form / Input / Select / DatePicker / Upload / ...74 ├── Data display → Table / List / Tree / Card / Descriptions / ...75 ├── Feedback → Message / Notification / Dialog / Drawer / Loading76 └── Advanced scenarios → Chat (AI conversation)77```7879### 2) Clarify context before making suggestions8081Before providing component recommendations, confirm:8283- Vue version (3.3+ recommended)84- Whether `ConfigProvider` is configured85- Whether dark mode support is needed86- Whether there are special i18n requirements87- Data volume (affects whether virtual scroll is needed)8889### 3) ConfigProvider configuration first9091```vue92<template>93 <ConfigProvider :global-config="globalConfig">94 <App />95 </ConfigProvider>96</template>9798<script setup lang="ts">99import { ConfigProvider } from "tdesign-vue-next";100101const globalConfig = {102 // Global configuration103};104</script>105```106107### 4) Component selection rules108109| Scenario | Recommended Component | Notes |110| ---------------------- | ---------------------------------- | ---------------------------------------------- |111| Simple list display | `List` | Small data, no complex interaction |112| Complex data table | `Table` | Supports sorting, filtering, pagination |113| Large data table | `Table` + `virtual-scroll` | Enable virtual scroll |114| Tree data selection | `TreeSelect` | Single/multiple tree selection |115| Cascading selection | `Cascader` | Multi-level linked selection |116| Simple dropdown | `Select` | Moderate number of options |117| Remote search select | `Select` + `filterable` + `remote` | Disable local filtering |118| File upload | `Upload` | Supports drag, multi-file |119| Form collection | `Form` + `FormItem` | Unified validation and submit |120| Light notification | `Message` | Operation feedback, auto-dismiss |121| Important notification | `Notification` | Requires user confirmation or contains actions |122| Confirmation action | `Dialog` / `Popconfirm` | Choose based on context |123| Side panel details | `Drawer` | Without interrupting page flow |124| AI conversation | `Chat` | Streaming messages, multi-turn dialogue |125126### 5) Form decision chain127128```129Need to collect user input?130 ├── Yes → Use Form wrapper131 │ ├── Need dynamic add/remove fields? → See form-advanced.md132 │ ├── Need cross-field linking? → See form-advanced.md133 │ └── Simple form → Use FormItem + rules134 └── No → Use input component directly135```136137### 6) Table decision chain138139```140Need to display list data?141 ├── Data > 1000 rows? → Enable virtual scroll, see table-advanced.md142 ├── Need server-side pagination/sorting? → See table-advanced.md143 ├── Need editable cells? → See table-advanced.md144 └── Simple table → Use Table + columns + data145```146147### 7) Theme customization decision chain148149```150Need to customize theme?151 ├── Only modify brand color → ConfigProvider theme prop152 ├── Modify multiple tokens → Override CSS variables153 ├── Deep customization → See theming-advanced.md154 └── Dark mode → See dark-mode.md155```156157### 8) Route complex scenarios to `Reference`158159When identifying trigger conditions from the Complex triggers table, must:1601611. Inform user this is a complex scenario1622. Open the corresponding Reference document1633. Provide suggestions based on recommended patterns in Reference164165### 9) Accessibility and performance checks166167- Ensure form controls have appropriate `label`168- Enable virtual scroll or pagination for large data scenarios169- Avoid complex calculations in `template`, use `computed`170- Ensure stable `key` for list rendering171172---173174## O - Output175176### Output should include (as needed)1771781. **Component recommendation**: Component name and selection rationale1792. **Minimal configuration**: Required ConfigProvider setup1803. **Code example**: Directly runnable `<script setup>` code1814. **Performance tips**: Notes for large data, frequent updates scenarios1825. **Reference path**: Point to corresponding reference docs for complex scenarios1836. **Official documentation link**: Related component's official documentation URL184185### Output forbidden1861871. Unverified APIs or props1882. Hack code relying on specific internal implementations1893. Incomplete code snippets (missing imports or key configurations)1904. Code for other TDesign tech stacks (React/Miniprogram)1915. Syntax incompatible with user's Vue version192193### Regression checklist194195- [ ] **ConfigProvider**: Is root component configured, are theme tokens effective196- [ ] **Form**: Are `rules` defined, is validation trigger (`trigger`) correct, is `model` two-way binding correct197- [ ] **Table**: Does `row-key` provide stable unique value, is `columns` cached with `computed`198- [ ] **Select**: Is local filtering disabled for remote search (`filterable` + `:filter` returns true)199- [ ] **Upload**: Is controlled mode `v-model:files` updating correctly, is `action` or `requestMethod` configured200- [ ] **Tree/TreeSelect**: Does `keys` config match data structure, does async load `load` function return Promise201- [ ] **Dialog/Drawer**: `v-model:visible` two-way binding, `destroyOnClose` configured based on scenario202- [ ] **Dark Mode**: Is `theme-mode` attribute added to `<html>` or root element203- [ ] **Icons**: Are icons correctly imported from `tdesign-icons-vue-next`204- [ ] **TypeScript**: Are component props types correct, do event callback parameter types match205206---207208## Quick Reference209210### Installation211212```bash213npm install tdesign-vue-next214# Icon library215npm install tdesign-icons-vue-next216```217218### Full Import219220```ts221// main.ts222import { createApp } from "vue";223import TDesign from "tdesign-vue-next";224import "tdesign-vue-next/es/style/index.css";225import App from "./App.vue";226227createApp(App).use(TDesign).mount("#app");228```229230### On-demand Import (Recommended)231232```ts233// main.ts234import { createApp } from "vue";235import { Button, Input, Form, FormItem } from "tdesign-vue-next";236import "tdesign-vue-next/es/style/index.css";237import App from "./App.vue";238239const app = createApp(App);240app.use(Button).use(Input).use(Form).use(FormItem);241app.mount("#app");242```243244### Minimal Example245246```vue247<template>248 <ConfigProvider>249 <Form :model="formData" :rules="rules" @submit="onSubmit">250 <FormItem label="Username" name="username">251 <Input v-model="formData.username" placeholder="Enter username" />252 </FormItem>253 <FormItem>254 <Button theme="primary" type="submit">Submit</Button>255 </FormItem>256 </Form>257 </ConfigProvider>258</template>259260<script setup lang="ts">261import { reactive } from "vue";262import {263 ConfigProvider,264 Form,265 FormItem,266 Input,267 Button,268} from "tdesign-vue-next";269import type { FormRules, SubmitContext } from "tdesign-vue-next";270271const formData = reactive({272 username: "",273});274275const rules: FormRules<typeof formData> = {276 username: [{ required: true, message: "Username is required" }],277};278279const onSubmit = ({ validateResult }: SubmitContext) => {280 if (validateResult === true) {281 console.log("Submit successful", formData);282 }283};284</script>285```286287### Official Resources288289- Official Documentation: https://tdesign.tencent.com/vue-next/overview290- GitHub: https://github.com/Tencent/tdesign-vue-next291- Design Specifications: https://tdesign.tencent.com/design/values