TDesign Uniapp

repository·develop·Indexed 41 days ago

https://github.com/novlan1/tdesign-uniapp

A high-quality UI component library designed by Tencent for the uniapp framework. It supports CLI and HBuilderX development workflows and includes specialized chat components such as ChatContent, ChatActionbar, and Attachments. The library provides a TDesignResolver for automatic component importing across Vite, Webpack, Rollup, Rspack, and esbuild.

Tokens
358.6K
Snippets
889
Records
1.4K
Agent score
46%

What's inside TDesign Uniapp

  1. TDesign Uniapp Component Overview

    develop

    TDesign Uniapp provides a comprehensive set of UI components for Uniapp development, categorized into several functional groups. The component library is continuously updated based on business practices.

    Component Categories:

    • Basic (基础): Core building blocks like Button, Divider, Fab, Icon, Layout, and Link.
    • Navigation (导航): Components for movement and structure, including BackTop, Drawer, Indexes, Navbar, SideBar, Steps, TabBar, and Tabs.
    • Input (输入): Data entry components such as Calendar, Cascader, CheckBox, ColorPicker, DateTimePicker, Form, Input, Picker, Radio, Rate, Search, Slider, Stepper, Switch, Textarea, TreeSelect, and Upload.
    • Data Display (数据展示): Components for presenting information, including Avatar, Badge, Cell, Collapse, CountDown, Empty, Footer, Grid, Image, ImageViewer, Progress, QRCode, Result, Skeleton, Sticky, Swiper, Tag, and Watermark.
    • Feedback (反馈): Components for user interaction and system status, such as ActionSheet, Dialog, DropdownMenu, Guide, Loading, Message, NoticeBar, Overlay, Popover, Popup, PullDownRefresh, SwipeCell, and Toast.
  2. TDesign Uniapp Component Categories

    develop

    TDesign Uniapp provides a comprehensive set of UI components organized into several functional categories to help build mobile applications. The available components are grouped as follows:

    Base

    Fundamental building blocks including Button, Divider, Fab, Icon, Layout, and Link.

    Components for moving through the application, such as BackTop, Drawer, Indexes, Navbar, SideBar, Steps, TabBar, and Tabs.

    Form

    Input and selection components for user data entry, including Calendar, Cascader, CheckBox, ColorPicker, DateTimePicker, Form, Input, Picker, Radio, Rate, Search, Slider, Stepper, Switch, Textarea, TreeSelect, and Upload.

    Data Display

    Components for presenting information, such as Avatar, Badge, Cell, Collapse, CountDown, Empty, Footer, Grid, Image, ImageViewer, Progress, QRCode, Result, Skeleton, Sticky, Swiper, Tag, and Watermark.

    Feedback

    Components for communicating state or providing user interaction feedback, including ActionSheet, Dialog, DropdownMenu, Guide, Loading, Message, NoticeBar, Overlay, Popover, Popup, PullDownRefresh, SwipeCell, and Toast.

  3. What is uni-sass and how to use it

    develop

    uni-sass is a set of global styles provided by uni-ui. It allows for simple page layout operations using standard class names and sass variables. You can use it to quickly apply styles for properties such as:

    • Colors
    • Margins (padding/margin)
    • Border radius

    For detailed documentation on specific class names and available variables, refer to the official uni-ui documentation.

  4. Choose the correct Popup placement for different UI scenarios

    develop

    When using the Popup component in tdesign-uniapp, select the placement based on the functional context of the content:

    • Top Placement: Use for filter conditions that are exposed at the top of a view, or as a top-down overlay.
    • Right Placement: Use when the popup is triggered by a specific entry point (like a filter icon) and needs to slide in from the side.
    • Bottom Placement: Use for task-oriented workflows or operations that are part of the main page flow (e.g., action sheets or task menus).
    • Center Placement:
      • Use for important notifications or when the user needs to make a critical decision.
      • Use for promotional activities or high-importance operational entries (e.g., splash screens/banners).
    • Left Placement: Use for collapsed navigation menus or sidebars.
  5. Compare Loading with similar components

    develop

    Depending on your specific use case, you may want to use a different component instead of Loading:

    ComponentWhen to use
    ProgressWhen a specific system task is in progress and you need to show the current progress to the user.
    PullDownRefreshWhen you need to refresh the entire page information or load more items of the same type.
  6. When to use the Divider component

    develop

    The Divider component should be used to distinguish between groups of content or to indicate hierarchical relationships between different information blocks.

    Layout Patterns

    • Full-width Divider (通栏分割线): A horizontal line that spans the entire width of the page. Use this to separate highly independent content blocks to make the separation more distinct.
    • Embedded Divider (内嵌分割线): A divider that typically leaves gaps on the left or right sides. Use this to separate related content within a single unified module, helping users browse large amounts of related information more efficiently.
    • Combined Divider (组合分割线): A layout that uses a combination of both full-width and embedded dividers.
  7. When to use the Result component

    develop

    The Result component is used to provide feedback to users after they have completed an operation.

    Common usage scenarios include:

    1. Lightweight Feedback: Use a popup/dialog to carry the result feedback if the task itself was performed within a popup or if only minimal feedback is required.
    2. Task Completion with Recommendations: Use a full page to display the result and recommend other content, tasks, or products to the user after a task is finished.
    3. Error/Failure States: Use the component to inform users of a failure reason and provide actionable steps to resolve the issue.
    4. Process Progress: Combine the Result component with a Steps component to show the remaining progress in a multi-step workflow after the current operation is complete.
  8. Compare Cell with Grid component

    develop

    When deciding between Cell and Grid, consider the layout and priority of your items:

    • Use Cell when you need a vertical list of information or navigation entries.
    • Use Grid when you need to display multiple functional or informational entry points that do not have a clear hierarchy or priority, typically in a multi-column layout.