Using with AI
How to use Source with AI to build accessible, logical, and consistent interfaces faster.
Machine-readable files
Two plain-text files are served at standard locations for AI tools that fetch documentation automatically.
Setup by tool
Cursor
Add Source to your .cursorrules file, or paste /llms.txt content as a project rule. For full token and component context, reference the raw GitHub files directly.
# .cursorrules
# Source design system context
# Full reference: https://github.com/pierredelattre/source-design-system/blob/main/TOKENS.md
# Component index: https://github.com/pierredelattre/source-design-system/blob/main/COMPONENTS.md
Token naming: --source-<category>-<name>
CSS class prefix: source-
All interactive components accept palette: neutral | accent | success | warning | danger | info
Semantic tokens reference primitives. Never reference another semantic token.
GitHub Copilot
Copilot picks up context from open files. Keep TOKENS.md and COMPONENTS.md open in your editor when working on Source components. For chat, reference the files explicitly with #file:TOKENS.md.
# In Copilot Chat
Using #file:TOKENS.md and #file:COMPONENTS.md, create a Chip component
that filters by status using the accent palette.
Claude Code
CLAUDE.md at the repo root instructs Claude to read TOKENS.md and COMPONENTS.md at the start of any task involving tokens or components. This is already configured in the repository.
# In the prompt
Using Source, add a filter row with Chip components for category selection.
Read TOKENS.md and COMPONENTS.md for the full API.
Any AI with URL fetching
Point the AI at /llms-full.txt for a complete context dump, or at the raw GitHub files for TOKENS.md and COMPONENTS.md.
Figma variable export
Generate a full variables export for Figma workflows with one command. The export includes primitives, semantic light/dark values, and component-level variables.
npm run figma:variables:export
# output: specs/figma-variables-export.json
Quick prompts
Copy-paste starting points for common tasks with Source.
Use a component
Using @pierredelattre/source-react and @pierredelattre/source-tokens,
build a status row that shows a Badge (success palette) and a Tag link.
Import styles from source-tokens. Reference COMPONENTS.md for props.
Use tokens in custom CSS
Style this component using only Source CSS custom properties.
Token names follow --source-<category>-<name>. Use semantic tokens
(--source-color-text, --source-spacing-4) rather than primitives.
Reference TOKENS.md for the full list.
Add a theme
Set the accent theme to green for this section. Apply data-source-theme="green"
on the wrapping element. Do not override any token values directly.
The accent tokens (--source-color-accent, --source-color-accent-subtle, etc.)
will resolve automatically.
Conventions summary
@media (prefers-color-scheme: dark) and .dark class. Primitives are constant.
neutral | accent | success | warning | danger | info on all interactive components.
data-source-theme="blue|green|red|orange|yellow|pink|purple|teal" on any element. No JS, no props.
source-tokens must load before source-react/styles.
Semantic color tokens
These are the tokens to use in application code. Primitives are available but should only appear in token definition files.
Spacing tokens
Radius tokens
Typography tokens
Components at a glance
Quick reference for all components. Full props and component tokens are in COMPONENTS.md.
palette, variant (subtle / solid / outline)
selected, disabled, palette, leadingIcon, trailingIcon, onClick
title, description, href, external, palette, icon, badge, disabled
href, palette, external
palette, href, external
defaultTab, activeTab, onTabChange, palette
Full usage example
import '@pierredelattre/source-tokens';
import '@pierredelattre/source-react/styles';
import { Badge, Chip, FeatureCard, Tabs, Tab, TabPanel, Tag, Link } from '@pierredelattre/source-react';
function Page() {
return (
<>
{/* Badge */}
<Badge palette="success">Live</Badge>
<Badge palette="danger" variant="solid">Deprecated</Badge>
{/* Chip — toggle */}
<Chip selected={activeOnly} onClick={() => setActiveOnly(!activeOnly)}>
Active only
</Chip>
{/* Link */}
<Link href="/docs" palette="accent">Read the docs</Link>
{/* Tag */}
<Tag href="/topics/react" palette="accent">React</Tag>
{/* FeatureCard */}
<FeatureCard
href="https://github.com/pierredelattre/source-design-system"
title="GitHub"
description="Source code and releases."
palette="accent"
external
/>
{/* Tabs */}
<Tabs defaultTab="overview">
<Tab id="overview">Overview</Tab>
<Tab id="code">Code</Tab>
<TabPanel id="overview">Overview content</TabPanel>
<TabPanel id="code">Code content</TabPanel>
</Tabs>
</>
);
}