design-system

Enforces UI primitive conventions for React components built on react-aria-components.

10|3|Updated Oct 23, 2023
One-click install
npx skills add https://github.com/Layer-Fi/layer-react --skill design-system-layer-fi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: design-system
Source: https://github.com/Layer-Fi/layer-react/tree/main/src/components/ui
Command: npx skills add https://github.com/Layer-Fi/layer-react --skill design-system-layer-fi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react-aria-components, react-i18next, react-intl, classnames, lucide-react, react-select, recharts, react-currency-input-field.

What problem does it solve? It prevents inconsistent UI code in the Layer component library by defining strict rules for building primitives: no raw divs or spans, style props instead of ad-hoc CSS, and data-attribute variants instead of concatenated class names. ## Core Features & Use Cases - Primitive-First Composition: Mandates Stack, Typography, Button, and related primitives from @ui/* instead of raw HTML elements, keeping the design system domain-agnostic. - Variant Styling Convention: Requires toDataProperties to emit data-* attributes (e.g. data-variant='ghost') styled via SCSS attribute selectors, never string-concatenated class names. - Accessibility by Default: Interactive primitives wrap react-aria-components for focus management, keyboard behavior, and ARIA attributes, with forwardRef and withRenderProp patterns. - Use Case: When adding a new Badge or Button variant, follow the gallery story pattern—one AllVariants story rendering the full variant × size × state matrix driven from the component's exported unions. ## Quick Start Ask the AI to create a new UI primitive component following the design-system rules in src/components/ui, with data-attribute variants and an AllVariants Storybook gallery story.

Frequently Asked Questions about design-system

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

FAQPage Schema
How do I create a new UI primitive component in this design system?▼

Wrap the appropriate react-aria-components base, forward refs, express variants through toDataProperties as data attributes, and style them with SCSS attribute selectors. Add one AllVariants gallery story covering the full variant and state matrix.

How should component variants be styled instead of CSS class modifiers?▼

Variants are data attributes, not class modifiers. Pass props through toDataProperties, which drops undefined and false values, then target them in SCSS with selectors like &[data-variant='ghost']. Never build class names by string concatenation.

Can I use raw div or span elements in Layer components?▼

No. Use HStack or VStack from @ui/Stack/Stack for layout and Span, P, Label, or Heading from @ui/Typography for text. Formatted money and durations use MoneySpan and DurationSpan respectively.

Does the design system support internationalization in primitives?▼

Yes. Every user-visible string, including aria-labels, goes through react-i18next's t() function, and formatting of currency, dates, and durations goes through the useIntlFormatter hook.

What Storybook stories are required for a new primitive?▼

Each primitive gets one AllVariants gallery story rendering the full variant × size × state matrix using Gallery, Section, Matrix, and Label from @testUtils/storybook/layout. A second story is added only for states the gallery cannot show, like an open overlay.