kanpeki

Use Kanpeki component library in React projects. Activate when user wants to add, use, customize, or compose accessible UI components from Kanpeki (@kanpeki/*). Covers installation, component patterns, forms, theming, and dark mode with React Aria Components + Tailwind CSS 4.1 + CVA.

7 stars

Best use case

kanpeki is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use Kanpeki component library in React projects. Activate when user wants to add, use, customize, or compose accessible UI components from Kanpeki (@kanpeki/*). Covers installation, component patterns, forms, theming, and dark mode with React Aria Components + Tailwind CSS 4.1 + CVA.

Teams using kanpeki should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/kanpeki/SKILL.md --create-dirs "https://raw.githubusercontent.com/fellipeutaka/denji/main/.agents/skills/kanpeki/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/kanpeki/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How kanpeki Compares

Feature / AgentkanpekiStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use Kanpeki component library in React projects. Activate when user wants to add, use, customize, or compose accessible UI components from Kanpeki (@kanpeki/*). Covers installation, component patterns, forms, theming, and dark mode with React Aria Components + Tailwind CSS 4.1 + CVA.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Kanpeki

Kanpeki is a copy-paste component library for React. Components are copied into your project (not installed as npm packages) via the shadcn CLI. Built on **React Aria Components** (accessibility), **CVA beta** (variants), and **Tailwind CSS 4.1** (styling).

Docs: https://kanpeki.vercel.app

## Quick Start

### 1. Install Dependencies

```bash
npm install cva@beta tailwind-merge tailwindcss-motion tailwindcss-react-aria-components react-aria-components -D
```

Remove shadcn defaults if present:
```bash
npm remove class-variance-authority clsx tw-animate-css
```

### 2. Create CVA Utility

`src/lib/cva.ts`:
```ts
import { defineConfig } from "cva";
import { twMerge } from "tailwind-merge";

export const { cva, cx: cn, compose } = defineConfig({
  hooks: {
    onComplete: (className) => twMerge(className),
  },
});
```

### 3. Configure Styles

Add to `globals.css`: Tailwind imports, plugins (`tailwindcss-react-aria-components`, `tailwindcss-motion`), `@custom-variant dark`, and OKLCH color tokens via `@theme inline`.

See [references/installation-setup.md](references/installation-setup.md) for full CSS.

### 4. Add Components

```bash
npx shadcn@latest add @kanpeki/button
npx shadcn@latest add @kanpeki/dialog
npx shadcn@latest add @kanpeki/field
```

Components are copied to `~/components/ui/<name>/`. You own the code.

## Component Architecture

Each component has: `index.ts` (exports), `<name>.tsx` (implementation), `styles.ts` (CVA variants).

### Simple Components

Single export. Example:

```tsx
import { Button } from "~/components/ui/button";

<Button variant="outline" size="lg">Click me</Button>
```

### Multi-Part Components

Namespace exports for compound components:

```tsx
import { Dialog } from "~/components/ui/dialog";

<Dialog.Root>
  <Button>Open</Button>
  <Dialog.Overlay>
    <Dialog.Modal>
      <Dialog.Content>
        <Dialog.Header>
          <Dialog.Title>Title</Dialog.Title>
          <Dialog.Description>Description</Dialog.Description>
        </Dialog.Header>
        <Dialog.Footer>
          <Button>Save</Button>
        </Dialog.Footer>
        <Dialog.Close />
      </Dialog.Content>
    </Dialog.Modal>
  </Dialog.Overlay>
</Dialog.Root>
```

Multi-part components with namespace exports: Accordion, Breadcrumb, ButtonGroup, Calendar, Card, Carousel, Chart, Combobox, DateField, DatePicker, Dialog, Drawer, Field, InputGroup, ListBox, Menu, NumberField, Pagination, Popover, RadioGroup, Resizable, ScrollArea, SearchField, Select, Sheet, Sidebar, Slider, Table, Tabs, Toast, ToggleGroup, Tooltip.

See [references/component-patterns.md](references/component-patterns.md) for full examples.

### Key Pattern: `composeRenderProps`

Always use `composeRenderProps` from `react-aria-components` when wrapping React Aria primitives. This ensures state-based selectors (`pressed:`, `selected:`, etc.) work.

```tsx
import { composeRenderProps } from "react-aria-components";

className={composeRenderProps(className, (className) =>
  Styles({ className, variant })
)}
```

For plain HTML elements (`div`, `p`), call CVA directly: `className={Styles({ className })}`.

## Form System

3-layer architecture: **Form** > **Field** > **Input component**.

### Field Composition

```tsx
import { Field } from "~/components/ui/field";
import { Input } from "~/components/ui/input";
import { TextField } from "~/components/ui/text-field";

<Field.Root render={<TextField type="email" isRequired />}>
  <Field.Label>Email</Field.Label>
  <Input placeholder="john@example.com" />
  <Field.Description>Help text</Field.Description>
  <Field.Error />
</Field.Root>
```

`Field.Root`'s `render` prop connects to a React Aria form primitive (TextField, Select, NumberField, etc.) for automatic label association and validation.

### InputGroup

```tsx
import { InputGroup } from "~/components/ui/input-group";

<InputGroup.Root>
  <InputGroup.Addon><SearchIcon /></InputGroup.Addon>
  <InputGroup.Input placeholder="Search..." />
</InputGroup.Root>
```

### TanStack Form

```tsx
<form.Field name="title">
  {(field) => (
    <Field.Root
      render={
        <TextField
          isInvalid={field.state.meta.isTouched && !field.state.meta.isValid}
          onChange={field.handleChange}
          onBlur={field.handleBlur}
          value={field.state.value}
        />
      }
    >
      <Field.Label>Title</Field.Label>
      <Input />
      <Field.Error errors={field.state.meta.errors} />
    </Field.Root>
  )}
</form.Field>
```

See [references/form-system.md](references/form-system.md) for full TanStack Form example with Zod validation.

## Styling & Theming

- **CVA** — variant definitions in `styles.ts`. Import `cva` from `~/lib/cva` (not `cva` directly).
- **`cn()`** — class merging utility from `~/lib/cva`. Wraps `twMerge`.
- **OKLCH colors** — defined in `globals.css` via `@theme inline`. Use `light-dark()` for automatic dark mode.
- **Dark mode** — `next-themes` (class strategy) + CSS `light-dark()`. Components auto-switch.
- **React Aria selectors** — `pressed:`, `selected:`, `disabled:`, `entering:`, `exiting:`, `focus-visible:`.
- **Animations** — `tailwindcss-motion` plugin: `motion-opacity-in`, `motion-scale-in-95`, `motion-duration-200`.

Override styles by passing `className` (twMerge resolves conflicts) or editing `styles.ts` directly.

See [references/styling-and-theming.md](references/styling-and-theming.md) for full token reference and CVA deep dive.

## Common Pitfalls

| Pitfall | Fix |
|---|---|
| Using `className={Styles(...)}` on React Aria components | Use `composeRenderProps` — required for state selectors |
| Missing `"use client"` directive | All interactive components need it (React Aria is client-only) |
| Importing `cva` from `"cva"` | Import from `~/lib/cva` — includes `twMerge` hook |
| Old shadcn deps installed (`class-variance-authority`, `clsx`) | Remove them, use `cva@beta` + `tailwind-merge` |
| Using `active:` for press state | Use `pressed:` — React Aria prefix |
| Using `@/` path alias | Kanpeki uses `~/` |

## Component List

Install any component: `npx shadcn@latest add @kanpeki/<name>`

**Layout & Structure:** card, separator, aspect-ratio, resizable, scroll-area, sidebar, collapsible, carousel

**Form Inputs:** input, textarea, text-field, number-field, search-field, checkbox, radio-group, select, combobox, autocomplete, switch, slider, date-field, date-picker, calendar, input-otp, dropzone, field, form, input-group

**Buttons & Actions:** button, button-group, link, link-button, toggle, toggle-group

**Overlays:** dialog, drawer, sheet, popover, tooltip, menu

**Data Display:** table, list-box, accordion, tabs, avatar, badge, keyboard, chart

**Feedback:** alert, toast, progress, spinner, skeleton

**Navigation:** breadcrumb, pagination

**Utilities:** label

## References

- [Installation & Setup](references/installation-setup.md) — full CSS, CVA config, dark mode, path alias
- [Component Patterns](references/component-patterns.md) — Button + Dialog examples, namespace pattern, customization
- [Form System](references/form-system.md) — Field/InputGroup/ButtonGroup API, TanStack Form + Zod example
- [Styling & Theming](references/styling-and-theming.md) — CVA deep dive, OKLCH tokens, React Aria selectors, animations

Related Skills

solid

7
from fellipeutaka/denji

Apply SOLID principles to write flexible, maintainable, and testable code. Use when designing classes, interfaces, and module boundaries. Covers Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion with practical TypeScript examples and detection heuristics.

denji

7
from fellipeutaka/denji

Manage SVG icons as framework components using Denji CLI. Use when the user needs to add, remove, list, export, import, or manage SVG icons in React, Preact, Solid, Qwik, Vue, or Svelte projects. Triggers include requests to "add an icon", "set up icons", "manage SVG icons", "remove an icon", "list icons", "export icons", "import icons", "dry-run icon add", or any task involving Iconify icons as framework components.

zod

7
from fellipeutaka/denji

Zod 4 — TypeScript-first schema validation with static type inference. Use when writing Zod schemas, validating data, defining types with Zod, parsing input, creating form validation schemas, defining API request/response schemas, working with z.object, z.string, z.number, z.enum, z.array, z.union, z.discriminatedUnion, z.file, z.jwt, z.email, z.uuid, z.url, z.codec, z.toJSONSchema, z.fromJSONSchema, z.int, z.stringbool, z.templateLiteral, z.record, z.partialRecord, or any other Zod API. Also use when migrating from Zod 3 to Zod 4, or when the user's package.json shows zod@^4. CRITICAL: Always use Zod 4 APIs. Never use deprecated Zod 3 patterns unless user explicitly requests Zod 3 compatibility.

web-design-guidelines

7
from fellipeutaka/denji

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

vercel-react-best-practices

7
from fellipeutaka/denji

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

vercel-composition-patterns

7
from fellipeutaka/denji

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

turborepo

7
from fellipeutaka/denji

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

tanstack-virtual

7
from fellipeutaka/denji

TanStack Virtual headless virtualization for React. Use when rendering large lists (100+ items), implementing virtual scroll, building infinite scroll feeds, virtualizing grids or tables, using window-level scrolling, or implementing masonry/lane layouts with @tanstack/react-virtual. Triggers on: useVirtualizer, useWindowVirtualizer, virtual list, virtual scroll, list virtualization.

tanstack-query

7
from fellipeutaka/denji

TanStack Query (React Query) v5 best practices for data fetching, caching, mutations, and server state management. Use when building data-driven React applications, setting up query configurations, implementing mutations/optimistic updates, configuring caching strategies, integrating with SSR, or fixing v4→v5 migration errors.

tanstack-pacer

7
from fellipeutaka/denji

TanStack Pacer best practices for execution control in React — debouncing, throttling, rate limiting, queuing, and batching. Use when implementing search inputs, scroll handlers, API rate limits, task queues, bulk operations, or any scenario requiring controlled execution timing with reactive state.

tanstack-hotkeys

7
from fellipeutaka/denji

Guide for implementing keyboard shortcuts in React using @tanstack/react-hotkeys. Use when building hotkey/shortcut features, registering keyboard shortcuts, handling key sequences, recording custom shortcuts, tracking held keys, or formatting hotkeys for display in React applications.

skill-creator

7
from fellipeutaka/denji

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.