| name | astryx |
| description | Build fully customizable, agent-ready design systems with Astryx โ Meta's production design system now open source. Ships 150+ React components built on StyleX with zero styling lock-in, component swizzling, brand theming, dark mode, and CLI tooling. Use when building component libraries, design systems, UI applications, design tokens, or when teams need consistent accessible components that AI agents can understand and extend. Triggers on: astryx, design system, component library, design tokens, react components, accessible components, astryx design, stylesheets, theme customization, component composition.
|
| allowed-tools | Read Write Edit Bash Grep Glob WebFetch Find Search |
| compatibility | Universal โ React 18+ and Node 22+ on active LTS. Works across all coding agents (Claude Code, Codex, Gemini CLI, OpenCode, Cursor, Copilot, jeopi, jeo). Astryx is agent-ready: all components are exported at the base level for full composability (no locked top-level API). Integrates with: `deep-agents-core` for agent-driven component design, `responsive-design` for layout verification, `react-best-practices` for component performance optimization, `react-grab` for UI element context capture. Upstream: https://github.com/facebook/astryx (MIT).
|
| metadata | {"tags":"astryx, design-system, react-components, component-library, design-tokens, accessibility, stylex, theming, ui-framework, meta","platforms":"Claude, Codex, Gemini, Cursor, OpenCode, jeopi, jeo, All","keyword":"astryx","version":"1.0.0","upstream":"https://github.com/facebook/astryx","source":"akillness/jeo-skills","license":"MIT"} |
Astryx โ Agent-Ready Design System
Astryx is an open source design system built
and proven at Meta over 8+ years across 13,000+ apps. It ships 150+ accessible
React components, brand-level theming, dark mode, templates, and a CLI โ all
designed for how teams build now: by people and the agents working alongside them.
Built on React and StyleX, Astryx
emphasizes open internals (no closed top-level API, full component composability),
zero styling lock-in (bring your own CSS, no special build plugin), and agent
readiness (components exported at the base level so AI assistants understand and
extend them).
Currently in Beta
When to use this skill
- You're building or scaling a component library and want production-proven
patterns from Meta
- You need 150+ accessible, ready-to-ship React components with dark mode,
theming, and templates
- Your design system must support both human and AI co-creation โ agents need
to understand, modify, and extend components safely
- You want zero styling lock-in โ bring your own CSS framework (Tailwind,
emotion, vanilla CSS) without fighting a design system build plugin
- You need component swizzling โ ability to eject a component's full source
into your project to customize without forking the library
- Your team values open internals and composability over a locked top-level API
- You want to leverage Meta's 8+ years of design system evolution across 13,000+
applications
When NOT to use this skill
- Building a simple one-off application (use Shadcn, Mantine, or MUI directly)
- Headless-only needs (no styled components required) โ route to component
architecture patterns
- Non-React projects โ Astryx is React-only; route to design token tools
- Quick prototype that won't outlive a quarter
Quick Start
Step 1 โ Install Astryx into your project
npm install @astryxdesign/core
npm install --save-dev @astryxdesign/cli
npm install --save-dev @astryxdesign/build
Astryx requires Node 22+ on an active LTS line and pnpm 11+ (or enable
Corepack):
corepack enable
pnpm install
Step 2 โ Import and use components
Astryx ships fully exported components at the base level. No compound component
API, no Context hell โ just import what you need:
import { Button, TextField, Card, Stack } from '@astryxdesign/core'
export function MyApp() {
return (
<Card>
<Stack gap="md">
<TextField label="Name" placeholder="Enter your name" />
<Button variant="primary">Submit</Button>
</Stack>
</Card>
)
}
Step 3 โ Apply theming and dark mode
Astryx supports brand-level theming and automatic dark mode via CSS
variables:
import { ThemeProvider } from '@astryxdesign/core'
export function App() {
return (
<ThemeProvider theme="light" // or "dark" or "auto"
colorScheme={{
primary: '#6741d9',
background: '#ffffff',
}}
>
<MyApp />
</ThemeProvider>
)
}
Dark mode responds to system preference automatically.
Step 4 โ Customize with swizzling
When you need to eject a component and own its implementation:
astryx swizzle Button --path src/components/Button
The ejected component is fully yours โ customizations survive library upgrades.
Step 5 โ Use templates for common patterns
Astryx ships ready-to-ship templates for common UI patterns:
astryx templates list
astryx templates create form --name MyForm
astryx templates create table --name MyDataTable
Core Concepts
Open Internals
Astryx exports primitives and building blocks at the base level, not locked
behind a closed top-level API. This means:
- You can compose
Button, Icon, Loader, Tooltip freely in any combination
- AI agents understand the component structure and can modify safely
- You're never fighting a framework-imposed constraint
Contrast: many design systems lock you into their compound component structure.
Astryx lets you build compound components yourself when you need them.
Zero Styling Lock-in
Astryx ships pre-built CSS using StyleX, but you're free to:
- Replace styling entirely with Tailwind CSS utilities
- Mix Astryx components with your own CSS framework
- Override component styles via CSS modules or emotion
- Use Astryx as a component anatomy reference while building your own styles
No build plugin required. No styling library forced into your bundle.
Agent Readiness
Every component is designed for AI co-creation:
- Flat export structure (agents find components without traversing nested APIs)
- Consistent prop naming and typing across all components
- TypeScript-first, so type definitions guide agent code generation
- Accessibility patterns built-in (so agents generate a11y-compliant code)
- Composable primitives (agents can extend safely)
Architecture Overview
Directory Structure
| Directory | Purpose |
|---|
packages/core | 150+ React components, theming engine, hooks |
packages/cli | Scaffolding, swizzling, template generation |
packages/build | Build tooling, asset optimization, CSS bundling |
packages/themes | Pre-built brand themes (light, dark, contrast-enhanced) |
apps/docsite | Full documentation (astryx.atmeta.com) |
apps/storybook | Interactive component explorer |
apps/sandbox | Live playground for quick prototyping |
Key Exports
export { Button, TextField, Select, Checkbox, Card, Stack, Grid, Modal, ... }
export { ThemeProvider, useTheme, useColorScheme, createTheme }
export { useFormField, useMediaQuery, useOnClickOutside, useFocusTrap, ... }
export { cn, cva, createVar, ... }
export { a11y, focus, hover, ... }
Usage Patterns
Pattern 1: Component Composition
Freely compose Astryx components without fighting a top-level API:
import { Button, Stack, Icon, Loader } from '@astryxdesign/core'
export function SubmitButton({ loading, onClick }) {
return (
<Button onClick={onClick} disabled={loading}>
<Stack direction="horizontal" gap="sm">
{loading && <Loader size="sm" />}
<span>Submit</span>
</Stack>
</Button>
)
}
Pattern 2: Custom Theme
Create a custom theme for your brand:
import { createTheme, ThemeProvider } from '@astryxdesign/core'
const brandTheme = createTheme({
primary: '#1f2937',
secondary: '#6366f1',
success: '#10b981',
error: '#ef4444',
fonts: {
body: '"Inter", sans-serif',
heading: '"Poppins", sans-serif',
},
})
export function App() {
return (
<ThemeProvider theme={brandTheme}>
<MyApp />
</ThemeProvider>
)
}
Pattern 3: Responsive Layout
Astryx's Grid and Stack components support responsive props:
import { Grid, Card } from '@astryxdesign/core'
export function Gallery() {
return (
<Grid
columns={{ mobile: 1, tablet: 2, desktop: 4 }}
gap="lg"
>
{items.map(item => (
<Card key={item.id}>{item.name}</Card>
))}
</Grid>
)
}
Pattern 4: Accessible Forms
Astryx form components handle a11y automatically:
import { FormField, TextField, Button } from '@astryxdesign/core'
export function LoginForm() {
return (
<form>
<FormField label="Email" required>
<TextField type="email" placeholder="user@example.com" />
</FormField>
<FormField label="Password" required>
<TextField type="password" placeholder="โขโขโขโขโขโขโขโข" />
</FormField>
<Button type="submit">Sign In</Button>
</form>
)
}
Integration with Agent Skills
deep-agents-core
Use when building AI-driven component design systems:
jeo @deep-agents-core create-component --design astryx
Agents can scaffold new components following Astryx patterns.
react-best-practices
Optimize Astryx component performance per Meta's patterns (Rule 2.1: avoid barrel
imports, Rule 4: client-side data fetching optimization):
import Button from '@astryxdesign/core/Button'
import { Button } from '@astryxdesign/core'
responsive-design
Verify your Astryx layouts work across viewports:
jeo @responsive-design verify --layout astryx-grid
react-grab
Capture exact React element context from a live UI to hand to an agent:
jeo @react-grab capture-element --selector ".astryx-button"
Returns: component name, source file, line number, HTML structure.
Common Tasks
Task 1: Create a new component using Astryx patterns
astryx generate component MyCard
npx @astryxdesign/cli component --name MyCard --destination src/components
Task 2: Customize an existing component
astryx swizzle Button
Task 3: Set up dark mode
Add prefers-color-scheme detection:
import { ThemeProvider } from '@astryxdesign/core'
export function App() {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
return (
<ThemeProvider theme={prefersDark ? 'dark' : 'light'}>
<MyApp />
</ThemeProvider>
)
}
Astryx handles CSS variable switching automatically.
Task 4: Migrate from another design system
Astryx's cva (class variance authority) and StyleX utilities work alongside other
CSS frameworks. Start by:
- Install Astryx alongside your current design system
- Import only the components you need
- Gradually replace old components with Astryx equivalents
- Remove old design system when migration is complete
Task 5: Build a design token consumer
Export Astryx design tokens for use in other tools (Figma, Zeplin):
import { theme } from '@astryxdesign/core'
const tokens = {
colors: theme.colors,
spacing: theme.spacing,
typography: theme.typography,
breakpoints: theme.breakpoints,
}
export { tokens }
Best Practices
-
Import directly from component modules โ avoid barrel imports in hot code
paths (see react-best-practices Rule 2.1)
-
Swizzle only when necessary โ eject components only when you need deep
customization; use props first
-
Use responsive props โ Astryx's responsive API (columns={{ mobile: 1, desktop: 4 }}) is performant; favor it over media queries
-
Compose over subclassing โ build custom components by composing Astryx
primitives, not by extending classes
-
Validate accessibility โ test swizzled components with automated a11y
tools (axe DevTools, Pa11y)
-
Theme at the app root โ wrap your entire app in <ThemeProvider>, not
individual routes
-
Leverage StyleX โ Astryx's StyleX integration provides zero-runtime CSS-in-JS
with zero bundle cost
-
Document custom components โ add Storybook stories to custom or swizzled
components for agent discoverability
Troubleshooting
Q: My custom theme colors aren't applying
A: Ensure <ThemeProvider> wraps your entire component tree at the app root.
Theme context is not inherited across portals or suspended components.
Q: TypeScript errors on custom component props
A: Astryx uses TypeScript 5.0+. Update your tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"moduleResolution": "bundler"
}
}
Q: Dark mode preference not detected
A: Check that prefers-color-scheme media query is supported in your browser.
Use window.matchMedia('(prefers-color-scheme: dark)').matches for detection.
Q: Swizzled component not updating when library version bumps
A: Swizzled components are frozen at the time of ejection. You own all future
updates. Watch the upstream repo for breaking changes you may want to backport.
Resources
Output Format
When the user asks for Astryx help, return a compact brief:
# Astryx Routing Brief
## Scope
- Task: setup | build-component | theme | migrate | swizzle | a11y-check | integrate
- Target: new-app | existing-app | design-tokens | agent-driven
## Recommended next move
- install-and-setup | scaffold-component | customize-theme | migrate-from-old-design-system | swizzle-component | run-a11y-tests | integrate-with-agent-skill
## Why
- 2-3 bullets grounded in the user's request
## Route-outs
- `deep-agents-core` for AI-driven component generation
- `react-best-practices` for component performance optimization
- `responsive-design` for layout verification across viewports
- `react-grab` for UI element context capture and inspection
Best Practices for Agents
-
Discover components via direct exports โ don't traverse nested modules;
Astryx exports all components at base level for agent simplicity
-
Respect swizzling boundaries โ only swizzle when a component needs deep
customization; use props for simple changes
-
Generate accessible code โ Astryx's built-in a11y patterns (labels,
ARIA, focus management) are already in place; don't duplicate
-
Test responsive layouts โ use columns={{ mobile, tablet, desktop }} and
verify on multiple breakpoints; don't hardcode widths
-
Preserve theming โ respect user theme context; don't hardcode colors
-
Compose primitives โ stack basic components (Button, Icon, Stack) to build
complex UI; don't create monolithic components
References