tdesign-miniprogram
TDesign WeChat Mini Program UI component library by Tencent. Use when building WeChat mini apps with TDesign components (Button, Dialog, Input, Tabs, Chat, etc.), implementing TDesign design system, customizing themes/dark mode, or building AI chat interfaces in mini programs.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- tdesign-miniprogram
- version
- 1.0.0
- homepage
- https://tdesign.tencent.com/miniprogram/overview
- description
- TDesign WeChat Mini Program UI component library by Tencent. Use when building WeChat mini apps with TDesign components (Button, Dialog, Input, Tabs, Chat, etc.), implementing TDesign design system, customizing themes/dark mode, or building AI chat interfaces in mini programs.
- allowed-tools
- Read,Write,Bash
- description_en
- TDesign WeChat Mini Program UI components, themes & AI chat
- description_zh
- TDesign 微信小程序组件库(60+ 组件、主题定制、AI 聊天)
02 资源文件 75
- 参考文档references/miniprogram-chat/components/attachments.md8.5 KB
- 参考文档references/miniprogram-chat/components/chat-actionbar.md4.7 KB
- 参考文档references/miniprogram-chat/components/chat-content.md3.7 KB
- 参考文档references/miniprogram-chat/components/chat-list.md51.4 KB
- 参考文档references/miniprogram-chat/components/chat-loading.md3.3 KB
- 参考文档references/miniprogram-chat/components/chat-markdown.md7.3 KB
- 参考文档references/miniprogram-chat/components/chat-message.md13.8 KB
- 参考文档references/miniprogram-chat/components/chat-sender.md30.7 KB
- 参考文档references/miniprogram-chat/components/chat-thinking.md7.5 KB
- 参考文档references/miniprogram-chat/getting-started.md2.4 KB
- 参考文档references/miniprogram-chat/sse.md5.0 KB
- 参考文档references/miniprogram/components/action-sheet.md9.9 KB
- 参考文档references/miniprogram/components/avatar.md11.1 KB
- 参考文档references/miniprogram/components/back-top.md2.7 KB
- 参考文档references/miniprogram/components/badge.md7.6 KB
- 参考文档references/miniprogram/components/button.md21.0 KB
- 参考文档references/miniprogram/components/calendar.md14.4 KB
- 参考文档references/miniprogram/components/cascader.md17.7 KB
- 参考文档references/miniprogram/components/cell.md7.9 KB
- 参考文档references/miniprogram/components/checkbox.md14.6 KB
- 参考文档references/miniprogram/components/collapse.md9.0 KB
- 参考文档references/miniprogram/components/count-down.md7.4 KB
- 参考文档references/miniprogram/components/date-time-picker.md13.2 KB
- 参考文档references/miniprogram/components/dialog.md21.6 KB
- 参考文档references/miniprogram/components/divider.md4.2 KB
- 参考文档references/miniprogram/components/drawer.md5.4 KB
- 参考文档references/miniprogram/components/dropdown-menu.md8.5 KB
- 参考文档references/miniprogram/components/empty.md3.0 KB
- 参考文档references/miniprogram/components/fab.md6.8 KB
- 参考文档references/miniprogram/components/footer.md4.8 KB
- 参考文档references/miniprogram/components/form.md3.4 KB
- 参考文档references/miniprogram/components/grid.md16.9 KB
- 参考文档references/miniprogram/components/guide.md23.0 KB
- 参考文档references/miniprogram/components/icon.md8.5 KB
- 参考文档references/miniprogram/components/image-viewer.md6.2 KB
- 参考文档references/miniprogram/components/image.md6.3 KB
- 参考文档references/miniprogram/components/indexes.md9.2 KB
- 参考文档references/miniprogram/components/input.md17.7 KB
- 参考文档references/miniprogram/components/link.md8.4 KB
- 参考文档references/miniprogram/components/list.md3.4 KB
- 参考文档references/miniprogram/components/loading.md7.1 KB
- 参考文档references/miniprogram/components/message.md9.4 KB
- 参考文档references/miniprogram/components/navbar.md8.5 KB
- 参考文档references/miniprogram/components/notice-bar.md9.6 KB
- 参考文档references/miniprogram/components/overlay.md2.3 KB
- 参考文档references/miniprogram/components/picker.md15.6 KB
- 参考文档references/miniprogram/components/popup.md7.4 KB
- 参考文档references/miniprogram/components/progress.md5.8 KB
- 参考文档references/miniprogram/components/pull-down-refresh.md6.7 KB
- 参考文档references/miniprogram/components/radio.md12.6 KB
- 参考文档references/miniprogram/components/rate.md11.4 KB
- 参考文档references/miniprogram/components/result.md4.5 KB
- 参考文档references/miniprogram/components/search.md8.6 KB
- 参考文档references/miniprogram/components/side-bar.md19.0 KB
- 参考文档references/miniprogram/components/skeleton.md7.5 KB
- 参考文档references/miniprogram/components/slider.md10.2 KB
- 参考文档references/miniprogram/components/stepper.md5.3 KB
- 参考文档references/miniprogram/components/steps.md13.1 KB
- 参考文档references/miniprogram/components/sticky.md3.9 KB
- 参考文档references/miniprogram/components/swipe-cell.md8.6 KB
- 参考文档references/miniprogram/components/swiper.md14.1 KB
- 参考文档references/miniprogram/components/switch.md7.8 KB
- 参考文档references/miniprogram/components/tab-bar.md12.0 KB
- 参考文档references/miniprogram/components/table.md3.4 KB
- 参考文档references/miniprogram/components/tabs.md13.0 KB
- 参考文档references/miniprogram/components/tag.md11.9 KB
- 参考文档references/miniprogram/components/textarea.md9.3 KB
- 参考文档references/miniprogram/components/toast.md6.8 KB
- 参考文档references/miniprogram/components/tree-select.md7.5 KB
- 参考文档references/miniprogram/components/upload.md14.8 KB
- 参考文档references/miniprogram/custom-style.md2.8 KB
- 参考文档references/miniprogram/custom-theme.md1.9 KB
- 参考文档references/miniprogram/dark-mode.md2.7 KB
- 参考文档references/miniprogram/getting-started.md2.4 KB
- 参考文档references/miniprogram/overview.md3.4 KB
03 SKILL.md 正文
TDesign Mini Program Skill
TDesign WeChat Mini Program component library, an enterprise-level design system by Tencent. Provides 60+ high-quality components with dark mode support, theme customization, and more.
When to Use This Skill
This skill should be triggered when:
- Developing WeChat Mini Programs with TDesign component library
- Using TDesign UI components (Button, Input, Dialog, etc.)
- Implementing interfaces following TDesign design specifications
- Configuring TDesign themes and style customization
- Building AI chat interfaces (using TDesign Chat components)
- Implementing dark mode adaptation
Quick Start
Installation
npm i tdesign-miniprogram -S --production
Modify app.json
Remove "style": "v2" from app.json to avoid style conflicts.
Modify project.config.json
Add the following to the setting section of project.config.json:
{
"setting": {
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
]
}
}
Modify tsconfig.json (TypeScript projects)
{
"paths": {
"tdesign-miniprogram/*": [
"./miniprogram/miniprogram_npm/tdesign-miniprogram/*"
]
}
}
After modifying project.config.json, build npm in WeChat DevTools:
Tools - Build npm
After successful build, check
Compile JS to ES5
Using Components
Import in page or component JSON file:
{
"usingComponents": {
"t-button": "tdesign-miniprogram/button/button"
}
}
Use in WXML:
<t-button theme="primary">Button</t-button>
Component Categories
Basic Components (6)
| Component | Description | Import Path |
|---|---|---|
| Button | Button | tdesign-miniprogram/button/button |
| Divider | Divider | tdesign-miniprogram/divider/divider |
| Fab | Floating Action Button | tdesign-miniprogram/fab/fab |
| Icon | Icon | tdesign-miniprogram/icon/icon |
| Layout | Layout | tdesign-miniprogram/row/row |
| Link | Link | tdesign-miniprogram/link/link |
Navigation Components (8)
| Component | Description | Import Path |
|---|---|---|
| BackTop | Back to Top | tdesign-miniprogram/back-top/back-top |
| Drawer | Drawer | tdesign-miniprogram/drawer/drawer |
| Indexes | Index List | tdesign-miniprogram/indexes/indexes |
| Navbar | Navigation Bar | tdesign-miniprogram/navbar/navbar |
| SideBar | Side Navigation | tdesign-miniprogram/side-bar/side-bar |
| Steps | Steps | tdesign-miniprogram/steps/steps |
| TabBar | Bottom Tab Bar | tdesign-miniprogram/tab-bar/tab-bar |
| Tabs | Tabs | tdesign-miniprogram/tabs/tabs |
Input Components (16)
| Component | Description | Import Path |
|---|---|---|
| Calendar | Calendar | tdesign-miniprogram/calendar/calendar |
| Cascader | Cascader | tdesign-miniprogram/cascader/cascader |
| CheckBox | Checkbox | tdesign-miniprogram/checkbox/checkbox |
| DateTimePicker | Date Time Picker | tdesign-miniprogram/date-time-picker/date-time-picker |
| Input | Input | tdesign-miniprogram/input/input |
| Picker | Picker | tdesign-miniprogram/picker/picker |
| Radio | Radio | tdesign-miniprogram/radio/radio |
| Rate | Rate | tdesign-miniprogram/rate/rate |
| Search | Search | tdesign-miniprogram/search/search |
| Slider | Slider | tdesign-miniprogram/slider/slider |
| Stepper | Stepper | tdesign-miniprogram/stepper/stepper |
| Switch | Switch | tdesign-miniprogram/switch/switch |
| Textarea | Textarea | tdesign-miniprogram/textarea/textarea |
| TreeSelect | Tree Select | tdesign-miniprogram/tree-select/tree-select |
| Upload | Upload | tdesign-miniprogram/upload/upload |
| Form | Form | tdesign-miniprogram/form/form |
Data Display Components (18)
| Component | Description | Import Path |
|---|---|---|
| Avatar | Avatar | tdesign-miniprogram/avatar/avatar |
| Badge | Badge | tdesign-miniprogram/badge/badge |
| Cell | Cell | tdesign-miniprogram/cell/cell |
| Collapse | Collapse | tdesign-miniprogram/collapse/collapse |
| CountDown | Countdown | tdesign-miniprogram/count-down/count-down |
| Empty | Empty State | tdesign-miniprogram/empty/empty |
| Footer | Footer | tdesign-miniprogram/footer/footer |
| Grid | Grid | tdesign-miniprogram/grid/grid |
| Image | Image | tdesign-miniprogram/image/image |
| ImageViewer | Image Viewer | tdesign-miniprogram/image-viewer/image-viewer |
| Progress | Progress | tdesign-miniprogram/progress/progress |
| Result | Result | tdesign-miniprogram/result/result |
| Skeleton | Skeleton | tdesign-miniprogram/skeleton/skeleton |
| Sticky | Sticky | tdesign-miniprogram/sticky/sticky |
| Swiper | Swiper | tdesign-miniprogram/swiper/swiper |
| Table | Table | tdesign-miniprogram/table/table |
| Tag | Tag | tdesign-miniprogram/tag/tag |
| List | List | tdesign-miniprogram/list/list |
Feedback Components (12)
| Component | Description | Import Path |
|---|---|---|
| ActionSheet | Action Sheet | tdesign-miniprogram/action-sheet/action-sheet |
| Dialog | Dialog | tdesign-miniprogram/dialog/dialog |
| DropdownMenu | Dropdown Menu | tdesign-miniprogram/dropdown-menu/dropdown-menu |
| Guide | Guide | tdesign-miniprogram/guide/guide |
| Loading | Loading | tdesign-miniprogram/loading/loading |
| Message | Message | tdesign-miniprogram/message/message |
| NoticeBar | Notice Bar | tdesign-miniprogram/notice-bar/notice-bar |
| Overlay | Overlay | tdesign-miniprogram/overlay/overlay |
| Popup | Popup | tdesign-miniprogram/popup/popup |
| PullDownRefresh | Pull Down Refresh | tdesign-miniprogram/pull-down-refresh/pull-down-refresh |
| SwipeCell | Swipe Cell | tdesign-miniprogram/swipe-cell/swipe-cell |
| Toast | Toast | tdesign-miniprogram/toast/toast |
AI Chat Components (9)
| Component | Description | Import Path |
|---|---|---|
| ChatList | Chat List | tdesign-miniprogram/chat-list/chat-list |
| ChatMessage | Chat Message | tdesign-miniprogram/chat-message/chat-message |
| ChatSender | Chat Sender | tdesign-miniprogram/chat-sender/chat-sender |
| ChatContent | Chat Content | tdesign-miniprogram/chat-content/chat-content |
| ChatActionbar | Chat Action Bar | tdesign-miniprogram/chat-actionbar/chat-actionbar |
| ChatLoading | Chat Loading | tdesign-miniprogram/chat-loading/chat-loading |
| ChatMarkdown | Chat Markdown | tdesign-miniprogram/chat-markdown/chat-markdown |
| ChatThinking | Chat Thinking | tdesign-miniprogram/chat-thinking/chat-thinking |
| Attachments | Attachments | tdesign-miniprogram/attachments/attachments |
Common Patterns
Button
<!-- Basic Buttons -->
<t-button theme="primary" size="large">Primary Button</t-button>
<t-button theme="light" size="large">Light Button</t-button>
<t-button size="large">Default Button</t-button>
<!-- Outline and Text Buttons -->
<t-button theme="primary" size="large" variant="outline"
>Outline Button</t-button
>
<t-button theme="primary" size="large" variant="text">Text Button</t-button>
<!-- Icon Button -->
<t-button
theme="primary"
icon="app"
content="Icon Button"
size="large"
></t-button>
<!-- Loading State -->
<t-button theme="primary" size="large" loading>Loading</t-button>
<!-- Disabled State -->
<t-button theme="primary" size="large" disabled>Disabled</t-button>
<!-- Block Button -->
<t-button theme="primary" size="large" block>Block Button</t-button>
<!-- Ghost Button (transparent background) -->
<t-button theme="primary" ghost size="large">Ghost Button</t-button>
Input
{
"usingComponents": {
"t-input": "tdesign-miniprogram/input/input"
}
}
<t-input
label="Label"
placeholder="Please enter"
value="{{value}}"
bind:change="onChange"
/>
Dialog
{
"usingComponents": {
"t-dialog": "tdesign-miniprogram/dialog/dialog"
}
}
<t-dialog
visible="{{visible}}"
title="Dialog Title"
content="Dialog content"
confirm-btn="Confirm"
cancel-btn="Cancel"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
Toast
import Toast from 'tdesign-miniprogram/toast/index';
Toast({
context: this,
selector: '#t-toast',
message: 'Toast message',
});
AI Chat Interface
{
"usingComponents": {
"t-chat-list": "tdesign-miniprogram/chat-list/chat-list",
"t-chat-message": "tdesign-miniprogram/chat-message/chat-message",
"t-chat-sender": "tdesign-miniprogram/chat-sender/chat-sender"
}
}
<t-chat-list layout="single">
<t-chat-message
avatar="{{item.avatar}}"
name="{{item.name}}"
content="{{item.content}}"
role="{{item.role}}"
/>
<view slot="footer">
<t-chat-sender bind:send="onSend" />
</view>
</t-chat-list>
Component({
data: {
messages: [
{
role: 'user',
content: [{ type: 'text', data: 'Hello' }],
},
{
role: 'assistant',
content: [{ type: 'text', data: 'Hello! How can I help you?' }],
},
],
},
methods: {
onSend(e) {
const { value } = e.detail;
// Handle send message
},
},
});
Style Customization
Method 1: Using Style Attribute
<t-button style="color: red">Custom Style</t-button>
<t-button custom-style="color: red">Custom Style</t-button>
Method 2: Disable Style Isolation
Override styles directly in page:
.t-button--primary {
background-color: navy;
}
In custom components, enable styleIsolation:
Component({
options: {
styleIsolation: 'shared',
},
});
Method 3: External Style Classes
<t-button t-class="my-button-class">Button</t-button>
.my-button-class {
background-color: navy !important;
}
Method 4: CSS Variables
TDesign provides rich CSS variables for theme customization:
page {
--td-button-primary-bg-color: #0052d9;
--td-button-border-radius: 8rpx;
}
Dark Mode
1. Modify app.json
{
"darkmode": true
}
2. Import Design Token
In app.wxss:
@import 'miniprogram_npm/tdesign-miniprogram/common/style/theme/_index.wxss';
3. Use CSS Variables
.text {
color: var(--td-text-color-secondary);
}
4. Special Component Adaptation
For components wrapped in custom-tab-bar or root-portal, add .page class:
<view class="page">
<t-tab-bar />
</view>
Reference Files
This skill includes comprehensive documentation in references/:
Basic Documentation
- miniprogram/getting-started.md - Quick start guide
- miniprogram/overview.md - Component overview
- miniprogram/custom-style.md - Style customization
- miniprogram/custom-theme.md - Theme customization
- miniprogram/dark-mode.md - Dark mode
Component Documentation (miniprogram/components/)
AI Chat Component Documentation (miniprogram-chat/)
- getting-started.md - Chat component quick start
- sse.md - SSE streaming
- components/chat-message.md - Chat message
- components/chat-sender.md - Chat sender
- components/chat-list.md - Chat list
- ... more chat component docs
Use Read tool to access specific reference files when detailed API information is needed.
Key Requirements
- Minimum base library version:
^2.12.0 - Build npm in WeChat DevTools required
- Remove
"style": "v2"fromapp.json
Resources
Notes
- This skill was automatically generated from TDesign official documentation
- Reference files preserve the structure and examples from source docs
- Some reference content remains in Chinese as per official documentation
04 同仓库更多 Skills
vercel-sandbox
Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.
slack
Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include "check my Slack", "what channels have unreads", "send a message to", "search Slack for", "extract from Slack", "find who said", or any task requiring programmatic Slack interaction.
electron
Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.
dogfood
Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", "test this app/site/platform", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.
agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
shadcn
Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", "switch to --preset", and for building a design system or applying a DESIGN.md or brand spec to shadcn/ui.