Skip to content
Skills Library
Programming · Building & coding

react-components

/react-components

Reusable React component APIs — buttons, cards, modals, tabs, dropdowns, shadcn/Radix primitives, compound components. Use when building or refining a single reusable component or a small family of them — button, card, modal, dropdown, tabs, accordion, tooltip, badge, avatar, select, popover — or when the request mentions shadcn/ui, Radix, compound components, forwardRef, CVA or asChild. Not for a whole page (landing-pages).

Licence
MIT
Last repository change
20.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
16
Scripts
10
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 20.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 10 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: examples/_r3f-jsx.d.ts, examples/_stubs.d.ts, examples/good-composition-patterns.test.tsx, examples/good-composition-patterns.tsx, examples/good-react19.test.tsx, examples/good-react19.tsx, examples/good-shadcn.test.tsx, examples/good-shadcn.tsx

What it does and when to use it

Reusable React component APIs — buttons, cards, modals, tabs, dropdowns, shadcn/Radix primitives, compound components. Use when building or refining a single reusable component or a small family of them — button, card, modal, dropdown, tabs, accordion, tooltip, badge, avatar, select, popover — or when the request mentions shadcn/ui, Radix, compound components, forwardRef, CVA or asChild. Not for a whole page (landing-pages).

Original author description

Reusable React component APIs — buttons, cards, modals, tabs, dropdowns, shadcn/Radix primitives, compound components. Use when building or refining a single reusable component or a small family of them — button, card, modal, dropdown, tabs, accordion, tooltip, badge, avatar, select, popover — or when the request mentions shadcn/ui, Radix, compound components, forwardRef, CVA or asChild. Not for a whole page (landing-pages).

How it works

  1. When to Use
  2. Stack
  3. Core Rules
  4. Patterns
  5. Examples
  6. Reference Index
  7. Constraints
Original SKILL.md headings · 45 lines, 537 words
SKILL.md preview
---
name: react-components
description: Reusable React component APIs — buttons, cards, modals, tabs, dropdowns, shadcn/Radix primitives, compound components. Use when building or refining a single reusable component or a small family of them — button, card, modal, dropdown, tabs, accordion, tooltip, badge, avatar, select, popover — or when the request mentions shadcn/ui, Radix, compound components, forwardRef, CVA or asChild. Not for a whole page (landing-pages).
metadata:
  version: "15.0.0"
  core-deps:
    - core/component-api.md
    - core/accessibility-baseline.md
---

# React Components

## When to Use
Building or refining a single reusable component or a small family of them: button, card, modal/dialog, dropdown, tabs, accordion, tooltip, badge, avatar, select, popover. Also any request mentioning shadcn/ui, Radix, compound components, `forwardRef`, CVA, or `asChild`. For a whole page use `landing-pages`; for inputs with validation use `forms`.

## Stack
React 19 · TypeScript strict · Tailwind v4 · shadcn/ui + Radix · Next.js App Router (default)

## Core Rules
1. **Prop taxonomy.** Behavioural props take native event names (`onClick`, `onSubmit`, `onOpenChange`) — never `onPress` on web. Stylistic props (`variant`, `size`) map to CVA variants. Compositional props are `children`, `asChild`, `render`.
2. **Ref forwarding.** React 19 passes `ref` as an ordinary prop; `forwardRef` remains correct for React 18 support and for anything extending shadcn/Radix. Pick one per codebase. When `forwardRef` is used it must take `(props, ref)`, return JSX, be exported, and set `displayName`.
3. **Base types from the element.** `interface XProps extends React.ComponentPropsWithoutRef<'button'>` — never re-declare `onClick`/`disabled` by hand.
4. **Spread last.** `{...props}` after your own attributes so consumers can override; merge `className` through `cn()` with consumer classes winning.
5. **Variants via CVA.** Export `VariantProps<typeof xVariants>` so wrappers can be typed. Discriminated string unions, never boolean soup (`primary`, `large`).
6. **Composition over configuration.** Three or more boolean props means the component should be compound instead. `<Card><CardHeader/><CardBody/></Card>`, not `<Card hasHeader hasBody/>`.
7. **Controlled contract.** Overlays use `open` + `onOpenChange` (+ `defaultOpen`). Inputs support both controlled and uncontrolled. State-heavy components are always controlled.
8. **`asChild` vs `as`.** `asChild` (Radix Slot) for behaviour wrappers; `as` only for typography/layout primitives. Never both on one component.
9. **Every interactive state.** default · hover · active · focus-visible · disabled · loading. Focus rings are `focus-visible:ring-2 ring-offset-2`, never `outline: none` without a replacement.

## Patterns
- **Compound + context** — parent owns state, parts read it via a `{ state, actions, meta }` context. Named exports, never dot-notation-only.
- **Slot composition** — `asChild` merges props onto the child element for triggers.
- **Polymorphic text** — `as` on `Heading`/`Text` changes the tag, not the behaviour.
- **Controlled/uncontrolled duality** — internal state falls back when the `value` prop is absent.

## Examples
`examples/good-composition-patterns.tsx` (compound Tabs, lifted state, asChild, CVA) · `examples/good-shadcn.tsx` (Dialog, Command, DataTable, Form) · `examples/good-react19.tsx` (useOptimistic, useActionState, Server Actions) · `examples/good-surgical-change.tsx` (scoped edit discipline).

## Reference Index
Load only for the specific task:

| Task | Load |
|---|---|
| Advanced composition, compound components, API anti-patterns, full forwardRef rules | `core/component-api-deep.md` |
| Hooks, context, error boundaries, React 19 APIs | `references/react-patterns.md` |
| The layer under shadcn — which package to install, `data-state` styling contract, `asChild`/Slot rules, exit animations, focus and dismissal, per-primitive labelling | `references/radix-primitives.md` |
| shadcn component usage, theming, `cn()`, CLI | `references/shadcn.md` |
| Community components, MagicUI/Aceternity, registries | `references/shadcn-ecosystem.md` |
| Icons, avatars, icon sizing and a11y | `../iconography/SKILL.md` |
| OKLCH technique, 8 interactive states, anchor positioning | `references/impeccable-techniques.md` |

## Constraints
TypeScript strict, exported prop interfaces, no implicit `any` · OKLCH tokens, no raw hex · `COMP-01` forwardRef correctness · `TS-01-AST` declared Props must be used · `A11Y-01/02` real ARIA and focus-visible on interactive elements only · four states with no mount-time fake delays · `prefers-reduced-motion` respected.
Files in this package (16)
  • SKILL.md 5 KB
  • examples/_r3f-jsx.d.ts 2 KB
  • examples/_stubs.d.ts 4 KB
  • examples/good-composition-patterns.test.tsx 2 KB
  • examples/good-composition-patterns.tsx 8 KB
  • examples/good-react19.test.tsx 1 KB
  • examples/good-react19.tsx 29 KB
  • examples/good-shadcn.test.tsx 1 KB
  • examples/good-shadcn.tsx 21 KB
  • examples/good-surgical-change.test.tsx 2 KB
  • examples/good-surgical-change.tsx 4 KB
  • references/impeccable-techniques.md 17 KB
  • references/radix-primitives.md 18 KB
  • references/react-patterns.md 32 KB
  • references/shadcn-ecosystem.md 25 KB
  • references/shadcn.md 17 KB

Versions

The database has no other skills named react-components.

Database snapshot: 13.11.2026 · package version 037af58b9499 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100radix-ui
    Expert guidance for building React UIs with Radix Themes and Radix Primitives. Use when creating accessible, customisable UI components, setting up theming systems, working with pre-styled Radix Themes components, or building custom components on top of unstyled Radix…
  • 100shadcn-ui
    shadcn/ui component patterns with Radix primitives and Tailwind styling. Use when building UI components, using CVA variants, implementing compound components, or styling with data-slot attributes. Triggers on shadcn, cva, cn(), data-slot, Radix, Button, Card, Dialog, VariantProps.
  • 90shadcn-code-review
    Reviews shadcn/ui components for CVA patterns, composition with asChild, accessibility states, and data-slot usage. Use when reviewing React components using shadcn/ui, Radix primitives, or Tailwind styling.
  • 100migrate-radix-to-base
    Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert radix primitives, or switch a shadcn project's base library. Handles single components ("migrate accordion") and whole projects.
  • 100ui-components
    UI component library patterns for shadcn/ui and Radix Primitives. Use when building accessible component libraries, customizing shadcn components, using Radix unstyled primitives, or creating design system foundations.
  • 100shadcn-components
    Use when building or editing shadcn/ui components, mapping Base UI vs Radix vs React Aria APIs, or choosing a composition pattern (render vs asChild vs trigger wrapper).

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.