Skip to content

Giới thiệu ​

thl-ui là design system độc lập framework, CSS tự viết (không Bootstrap, không jQuery), cung cấp component native cho React, Vue và Angular.

Kiến trúc ​

            ┌────────────────────────── @thl-ui/core ──────────────────────────┐
            │  createThl()  →  store cấu hình · i18n · applyToDocument()        │
            │  headless: tabs · table · select · toast · upload · calendar …    │
            │  utils: bem() · cx() · focusTrap · scrollLock · clickOutside      │
            └───────────────▲──────────────────▲──────────────────▲────────────┘
                            │                  │                  │
   @thl-ui/tokens ──► @thl-ui/styles (CSS vars, BEM .thl-*, 12 skin, dark)
                            │                  │                  │
                  @thl-ui/react         @thl-ui/vue        @thl-ui/angular
               ThlProvider + hooks   plugin + composables  provideThlUI + signals
PackageVai trò
@thl-ui/tokensDesign token (bảng màu, khoảng cách, bo góc, skin) → CSS custom properties
@thl-ui/stylesCSS không phụ thuộc framework (thl-ui.css, CSS từng component, nguồn SCSS)
@thl-ui/localesBản dịch en, ja, vi, zh + kiểu
@thl-ui/coreCấu hình, i18n, headless state machine, tiện ích
@thl-ui/iconsRegistry icon (bộ lucide, mở rộng được bằng font icon)
@thl-ui/chartsHình học biểu đồ SVG không phụ thuộc thư viện
@thl-ui/react · @thl-ui/vue · @thl-ui/angularAdapter native

Một API, ba framework ​

Mọi adapter sinh ra markup giống hệt nhau (cùng dùng bem()) và cùng tên prop:

vue
<ThlButton variant="primary" icon="download" rounded>Tải xuống</ThlButton>
tsx
<Button variant="primary" icon="download" rounded>Tải xuống</Button>
html
<button thl-button variant="primary" icon="download" rounded>Tải xuống</button>

Khác biệt chỉ nằm ở thói quen của từng framework:

Khái niệmVueReactAngular
Cài đặtapp.use(ThlUI, config)<ThlProvider config>provideThlUI(config)
Binding 2 chiềuv-modelvalue + onChange[(value)], formControlName, ngModel
DịchuseI18n().t / $tuseT()ThlI18nService.t / | thlT
Cấu hìnhuseThlConfig()useThlConfig()ThlConfigService
ToastuseToast()useToast()ThlToastService
Xác nhậnconfirm()confirm()ThlModalService.confirm()
Tên componentThlButtonButtonThlButtonComponent / selector thl-*

Tiếp theo ​