build-primitive

Builds accessible React UI primitives from scratch with ARIA contracts and keyboard navigation.

3|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/langgenius/due-date-hq-jwl --skill build-primitive-langgenius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-primitive
Source: https://github.com/langgenius/due-date-hq-jwl/tree/main/.claude/skills/build-primitive
Command: npx skills add https://github.com/langgenius/due-date-hq-jwl --skill build-primitive-langgenius

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When no Base UI primitive exists for a component you need — such as Breadcrumb, Rating, Tag Input, Calendar, or Data Table — building one from scratch means getting ARIA roles, keyboard navigation, focus management, controlled/uncontrolled state, and form integration right, which is easy to get wrong. ## Core Features & Use Cases - Decision Gate: Determines whether to wrap an existing Base UI primitive, compose from primitives, adopt a headless library (react-aria, cmdk, embla, dnd-kit), or build from scratch. - Four Component Templates: Provides complete TypeScript implementations for presentational, interactive, form-control, and composite components, including useControllableState and useRovingFocus hooks. - ARIA and Keyboard References: Maps components to correct ARIA roles and state attributes, and documents keyboard patterns including roving tabindex, aria-activedescendant, grid navigation, and typeahead. - Use Case: You need a Rating component with arrow-key adjustment, slider ARIA semantics, and hover preview. Follow the Interactive Template to produce a component with controlled/uncontrolled value, Home/End support, and disabled/readOnly states. ## Quick Start Ask the assistant to build a new Tag Input component from scratch with keyboard support and form submission using the build-primitive skill.

Frequently Asked Questions about build-primitive

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an accessible React component from scratch?

Start with the ARIA contract: pick the correct role and state attributes, then implement keyboard navigation, then controlled/uncontrolled state via a useControllableState hook, then styling hooks with data-slot attributes. The skill provides templates for presentational, interactive, form-control, and composite components.

When should I build a primitive instead of using Base UI?

Build from scratch only when no Base UI primitive covers the component, such as Breadcrumb, Avatar, Badge, Rating, Pagination, or Tag Input. If a primitive partially exists, compose from it; if a headless library like react-aria or cmdk handles the state machine, wrap it instead.

What headless libraries should I use for complex React components?

Use react-aria for date pickers, @tanstack/react-table for data tables, cmdk for command palettes, embla-carousel-react for carousels, react-resizable-panels for split layouts, and @dnd-kit/core for drag and drop. Wrap them with your own styling rather than reimplementing the state machine.

How do I make a custom React component work with native form submission?

Render hidden input elements mirroring the component's value: one hidden input for single values, or one per item for multi-value controls like Tag Input. For required validation, render a visually hidden required text input when the value is empty so native constraint validation triggers.

What is the difference between roving tabindex and aria-activedescendant?

Roving tabindex moves actual DOM focus between items, keeping only one item in the tab order, and suits toolbars, tabs, and pagination. aria-activedescendant keeps focus on an input while highlighting list items, and suits comboboxes, virtualized lists, and typeahead search.