Logo Component Patterns

Component Patterns

Cộng đồng
flitzrrr
component-patterns

Modern UI component selection, composition, and theming patterns for web applications. Covers compound components, design tokens, variant systems, responsive patterns, and form architecture derived from 21st.dev SDK, Godly featured products, and current best practices.

Tổng quan

Nhà phát hànhflitzrrr
Kho mãfrontend-design-skills
Tên kỹ năngcomponent-patterns
Sao
9
Bản fork
2
Tệp đi kèm
2
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được flitzrrr công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Component Patterns trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/flitzrrr/frontend-design-skills/tree/main/skills-src/component-patterns
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/flitzrrr/frontend-design-skills.git /tmp/frontend-design-skills
mkdir -p .claude/skills
cp -r /tmp/frontend-design-skills/skills-src/component-patterns .claude/skills/component-patterns
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Component Patterns trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Component Patterns ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Component Patterns với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Component-Patterns

Modern UI component patterns for web applications. Component selection, composition, theming, and token systems following current standards (21st.dev SDK, Tailwind, Radix UI).

Scope

Use this skill when:

  • You are designing or selecting UI components
  • You are building a design token system
  • You are implementing theming (dark/light/custom)
  • You are planning compound components or variant systems
  • You are designing form architectures
  • You are defining responsive component strategies

Principles

1. Composition over Inheritance

Build components by assembling small, specialized parts. Props for configuration, children for content, slots for variation.

2. Server-First, Client Where Needed

Server Components as the default. Client Components only for interactivity (state, event handlers, browser APIs).

3. Token-Based Theming

Design tokens (CSS Custom Properties) control all visual aspects. No hardcoding of colors, spacing, or font sizes.

4. Accessibility as Architecture

ARIA roles, keyboard navigation, and focus management are part of the component definition, not an afterthought.

5. Composable Primitives

Base primitives (Button, Input, Text, Box) are unstyled and maximally flexible. Design system components build on top of them.

Rules

Component Structure

  • DO: Each component as a single file with a clear export. One component = one responsibility.
  • DO: Explicitly type the props interface (TypeScript). Zod schemas for validated inputs.
  • DO: Compound components for complex UI elements:
    <Card>
      <Card.Header />
      <Card.Body />
      <Card.Footer />
    </Card>
  • DO: Variants with class-variance-authority (cva) instead of conditional classes.
  • DON'T: Components with more than 10 props. Split when responsibilities grow too many.
  • DON'T: Runtime CSS-in-JS. Tailwind CSS or CSS Modules for static styles.
  • DON'T: Div soup. Use semantic HTML elements (section, article, nav, header, footer, main).

Theming and Design Tokens

  • DO: Three-tier token system:
    • Global Tokens: Raw values (colors.blue.500, spacing.4, radius.md)
    • Semantic Tokens: Purpose-bound (color.primary, color.surface, spacing.section)
    • Component Tokens: Specific (button.bg, card.padding, input.border)
  • DO: Theme switching via CSS Custom Properties with a data attribute or class on html/body.
  • DO: Dark/light as minimum. Optionally: high contrast, brand-specific themes.
  • DON'T: Inline styles for themeable values. Always reference tokens.
  • DON'T: Token names that describe colors (--blue-500). Use semantic names (--color-primary).

Form Components

  • DO: Schema-driven forms: Zod schemas define fields and validation.
  • DO: React Hook Form or similar for performance (uncontrolled components).
  • DO: Consistent field anatomy: Label > Input > Helper Text > Error Message.
  • DON'T: Custom selects without keyboard support. Use native Select or Radix UI Select.
  • DON'T: Forms without loading and success states after submit.

Responsive Components

  • DO: Container queries for component-based responsiveness.
  • DO: Mobile variants as dedicated states (chat panel becomes fullscreen, sidebar becomes drawer).
  • DO: Touch targets at least 44x44px on mobile.
  • DON'T: Hover-dependent interactions without a touch alternative.
  • DON'T: Horizontal scrolling in components on mobile (exception: carousels).

Extended rules and code examples: see references/implementation.md

Patterns

PatternUsageCore Idea
Three-Panel LayoutDashboards, chat appsNavigation (240px) + Content (flex) + Context (320px)
Progressive Disclosure CardComplex data, API responsesSummary > Details > Raw Data
Form-Agent HybridForm assistantsForm left, chat right, agent populates fields
Real-Time Status DashboardMonitoring, DevOpsLive updates via WebSocket/SSE, color-coded tiles
Skill Configuration PanelAgent setupSystem prompt + skill library + deploy button

Detailed pattern descriptions: see references/patterns.md

Anti-Patterns

  1. God Component -- One component for chat, tools, form, and navigation simultaneously. Split it up.
  2. Prop drilling for theme -- Theme values passed through 5+ levels. Use context or CSS Custom Properties.
  3. Client-side everything -- Everything as a Client Component. Use Server Components for static content.
  4. Inline styles for layout -- style={{ marginTop: 20 }} instead of token-based utilities.
  5. Modal for everything -- Prefer inline expansion, drawers, or panels.
  6. Uncontrolled state explosion -- Use a central state store or server state (React Query/SWR).
  7. Hardcoded breakpoints -- Define breakpoint tokens in the theme configuration.
  8. Missing error boundaries -- Place React Error Boundaries around critical sections.

Checklist

  • Every component has a typed props interface (TypeScript)
  • Compound components for complex elements (Card, Dialog, Tabs)
  • Variants with cva or similar system
  • Design tokens in three tiers: global, semantic, component
  • Theme switch via CSS Custom Properties, not JS runtime
  • Forms use Zod schemas for validation
  • Server Components as default, client only when needed
  • Container queries for component-based responsiveness
  • Error boundaries around critical UI sections
  • Mobile touch targets at least 44x44px
  • Keyboard navigation for all interactive elements
  • ARIA roles and labels for screen readers
  • Semantic HTML elements instead of div soup

Cross-References

  • design-trends -- Trends influencing component design (motion, dark mode)
  • ui-patterns -- UI patterns implemented as components
  • visual-direction -- Visual tokens (colors, typography, spacing) for the token system
  • agent-ui-design -- Agent-specific components (chat, tools, streaming)
  • accessibility -- Accessibility requirements
  • responsive-design -- Breakpoint strategies and container queries

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Component Patterns làm được gì?

Modern UI component selection, composition, and theming patterns for web applications. Covers compound components, design tokens, variant systems, responsive patterns, and form architecture derived from 21st.dev SDK, Godly featured products, and current best practices.

Vì sao nên dùng Component Patterns trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Component Patterns là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Component Patterns trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/flitzrrr/frontend-design-skills/tree/main/skills-src/component-patterns. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Component Patterns?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Component Patterns với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Component Patterns với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Component Patterns có miễn phí không?

Có. Kỹ năng này được flitzrrr phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇