heroui-react
Skill này làm gì
Skill này hướng dẫn xây dựng giao diện web bằng thư viện thành phần HeroUI phiên bản 3 cho React. Skill bao gồm cài đặt, thiết lập chủ đề và cách dùng cấu trúc thành phần ghép.
Khi nào nên dùng
- ✓Khi bạn đang xây dựng một trang hoặc ứng dụng web React bằng các thành phần HeroUI.
- ✓Khi bạn muốn thiết lập chủ đề sáng và tối cho một dự án web HeroUI.
- ✓Khi bạn cần tài liệu cho một thành phần HeroUI, như modal hoặc biểu mẫu.
Liên kết skill
https://github.com/heroui-inc/heroui/blob/v3/skills/heroui-react/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xây dựng một trang biểu mẫu liên hệ bằng React với các thành phần HeroUI v3, có tùy chọn chế độ tối.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent đọc tài liệu phiên bản 3 trước, vì các mẫu v2 cũ không còn áp dụng. Nó cài đặt thư viện, thiết lập chủ đề và viết các thành phần theo cấu trúc ghép.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
HeroUI v3 React Development Guide
HeroUI v3 is a component library built on Tailwind CSS v4 and React Aria Components, providing accessible, customizable UI components for React applications.
Installation
curl -fsSL https://heroui.com/install | bash -s heroui-react
CRITICAL: v3 Only - Ignore v2 Knowledge
This guide is for HeroUI v3 ONLY. Do NOT apply v2 patterns — the provider, styling, and component API all changed:
| Feature | v2 (DO NOT USE) | v3 (USE THIS) |
|---|---|---|
| Provider | <HeroUIProvider> required |
No Provider needed |
| Animations | framer-motion package |
CSS-based, no extra deps |
| Component API | Flat props: <Card title="x"> |
Compound: <Card><Card.Header> |
| Styling | Tailwind v3 + @heroui/theme |
Tailwind v4 + @heroui/styles |
| Packages | @heroui/system, @heroui/theme |
@heroui/react, @heroui/styles |
// DO NOT DO THIS - v2 pattern
import { HeroUIProvider } from "@heroui/react";
import { motion } from "framer-motion";
<HeroUIProvider>
<Card title="Product" description="A great product" />
</HeroUIProvider>;
CORRECT (v3 patterns)
// DO THIS - v3 pattern (no provider, compound components)
import { Card } from "@heroui/react";
<Card>
<Card.Header>
<Card.Title>Product</Card.Title>
<Card.Description>A great product</Card.Description>
</Card.Header>
</Card>;
Always fetch v3 docs before implementing.
Core Principles
- Semantic variants (
primary,secondary,tertiary) over visual descriptions - Composition over configuration (compound components)
- CSS variable-based theming with
oklchcolor space - BEM naming convention for predictable styling
Accessing Documentation & Component Information
For component details, examples, props, and implementation patterns, always fetch documentation:
Using Scripts
# List all available components
node scripts/list_components.mjs
# Get component documentation (MDX)
node scripts/get_component_docs.mjs Button
node scripts/get_component_docs.mjs Button Card TextField
# Get component source code
node scripts/get_source.mjs Button
# Get component CSS styles (BEM classes)
node scripts/get_styles.mjs Button
# Get theme variables
node scripts/get_theme.mjs
# Get non-component docs (guides, releases)
node scripts/get_docs.mjs /docs/react/getting-started/theming
Direct MDX URLs
Component docs: fetch .mdx with a concrete kebab-case slug. Run node scripts/list_components.mjs when the slug is unknown, and never fetch a URL that still contains a placeholder.
Examples:
- Button:
https://heroui.com/docs/react/components/button.mdx - Modal:
https://heroui.com/docs/react/components/modal.mdx - Form:
https://heroui.com/docs/react/components/form.mdx
Getting started guides: use a concrete topic URL such as https://heroui.com/docs/react/getting-started/quick-start.mdx.
Important: Always fetch component docs before implementing. The MDX docs include complete examples, props, anatomy, and API references.
Installation Essentials
Quick Install
npm i @heroui/styles @heroui/react tailwind-variants
Framework Setup (Next.js App Router - Recommended)
- Install dependencies:
npm i @heroui/styles @heroui/react tailwind-variants tailwindcss @tailwindcss/postcss postcss
- Create/update
app/globals.css:
/* Tailwind CSS v4 - Must be first */
@import "tailwindcss";
/* HeroUI v3 styles - Must be after Tailwind */
@import "@heroui/styles";
- Import in
app/layout.tsx:
import "./globals.css";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<body>
{/* No Provider needed in HeroUI v3! */}
{children}
</body>
</html>
);
}
- Configure PostCSS (
postcss.config.mjs):
export default {
plugins: {
"@tailwindcss/postcss": {},
},
};
Critical Setup Requirements
- Tailwind CSS v4 is MANDATORY - HeroUI v3 will NOT work with Tailwind CSS v3
- Use Compound Components - Components use compound structure (e.g.,
Card.Header,Card.Content) - **Use o
Câu hỏi thường gặp
Tôi có cần một wrapper provider không?
Không. Phiên bản 3 không yêu cầu thành phần provider.
Các card được cấu trúc thế nào?
Card được xây dựng từ các phần như header, ví dụ dùng wrapper Card với phần Card.Header.
Nó có dùng Tailwind CSS không?
Có. Nó dùng Tailwind phiên bản 4 cùng gói kiểu HeroUI.
Chi tiết
Mô tả gốc của tác giả
HeroUI v3 React component library (Tailwind CSS v4 + React Aria). Use when building UIs with HeroUI — creating Buttons, Modals, Forms, Cards; installing @heroui/react; configuring dark/light themes with oklch variables; or fetching component docs. Keywords: HeroUI, Hero UI, heroui, @heroui/react, @heroui/styles.
repo: heroui-inc/heroui
Độ phổ biến
- Sao GitHub
- 31k
- Vị trí xếp hạng
- #9327
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
heroui-migration
31kGiúp agent của bạn nâng cấp ứng dụng web HeroUI v2 lên HeroUI v3, gồm các mẫu thành phần đã thay đổi và các hook đã bị gỡ bỏ.
heroui-native
31kGiúp agent của bạn xây dựng màn hình ứng dụng di động bằng các thành phần HeroUI Native, như nút, card và hộp thoại.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.