import { useState } from 'react'
import styles from './PrimitivesSection.module.css'
import {
Alert,
Avatar,
Badge,
Button,
Card,
Checkbox,
CodeBlock,
Collapsible,
DateRangePicker,
DateTimePicker,
EmptyState,
FilterPill,
FormField,
InfoCallout,
Input,
KeyboardHint,
Label,
MonoText,
Pagination,
ProgressBar,
RadioGroup,
RadioItem,
SectionHeader,
Select,
Skeleton,
Sparkline,
Spinner,
StatCard,
StatusDot,
Tag,
Textarea,
Toggle,
Tooltip,
} from '../../../design-system/primitives'
// ── helpers ──────────────────────────────────────────────────────────────────
interface DemoCardProps {
id: string
title: string
description: string
children: React.ReactNode
}
function DemoCard({ id, title, description, children }: DemoCardProps) {
return (
{title}
{description}
{children}
)
}
// ── Sample data ───────────────────────────────────────────────────────────────
const SPARKLINE_DATA = [10, 25, 15, 30, 20, 35, 28]
const CODE_JSON = JSON.stringify(
{ status: 'ok', version: '2.4.1', routes: 42 },
null,
2,
)
// ── PrimitivesSection ─────────────────────────────────────────────────────────
export function PrimitivesSection() {
// Alert state
const [alertDismissed, setAlertDismissed] = useState(false)
// Checkbox state
const [checked1, setChecked1] = useState(false)
const [checked2, setChecked2] = useState(true)
// Toggle state
const [toggleOn, setToggleOn] = useState(true)
const [toggleOff, setToggleOff] = useState(false)
// Radio state
const [radioV, setRadioV] = useState('option-a')
const [radioH, setRadioH] = useState('beta')
// Pagination state
const [page, setPage] = useState(5)
// DateTimePicker state
const [dtValue, setDtValue] = useState(new Date('2026-03-18T09:00'))
// DateRangePicker state
const [dateRange, setDateRange] = useState({
start: new Date('2026-03-11T00:00'),
end: new Date('2026-03-18T23:59'),
})
return (
Primitives
{/* 1. Alert */}
This is an informational message.
Operation completed successfully.
This action may have side effects.
{!alertDismissed && (
setAlertDismissed(true)}
>
Something went wrong. Dismiss to clear.
)}
{alertDismissed && (
setAlertDismissed(false)}>
Reset dismissed alert
)}
{/* 2. Avatar */}
{/* 3. Badge */}
{/* 4. Button */}
Primary
Secondary
Danger
Ghost
Small
Medium
Loading
{/* 5. Card */}
Plain card
Amber accent
Success accent
Error accent
{/* 6. Checkbox */}
setChecked1(e.target.checked)}
/>
setChecked2(e.target.checked)}
/>
{/* 7. CodeBlock */}
{/* 8. Collapsible */}
Hidden content revealed on expand.
This content is visible from the start.
{/* 9. DateTimePicker */}
d && setDtValue(d)}
/>
{/* 10. DateRangePicker */}
{/* 11. EmptyState */}
📭}
title="No results found"
description="Try adjusting your filters or search query."
action={Clear filters }
/>
{/* 12. FilterPill */}
{/* 13. FormField */}
{/* 14. InfoCallout */}
Review before publishing.
Deployment completed.
Rate limit approaching.
Build failed — check logs.
{/* 15. Input */}
{/* 16. KeyboardHint */}
{/* 17. Label */}
Plain label
Required label
{/* 18. MonoText */}
xs: route-id-001
sm: route-id-001
md: route-id-001
{/* 19. Pagination */}
{/* 20. ProgressBar */}
{/* 21. Radio */}
{/* 22. SectionHeader */}
{/* 23. Select */}
{/* 24. Skeleton */}
{/* 25. Sparkline */}
{/* 26. Spinner */}
{/* 27. StatCard */}
{/* 28. StatusDot */}
{(['live', 'stale', 'dead', 'success', 'warning', 'error', 'running'] as const).map(
(v) => (
{v}
),
)}
live + pulse
{/* 29. Tag */}
undefined} />
{/* 30. Textarea */}
{/* 31. Toggle */}
setToggleOn(e.target.checked)}
/>
setToggleOff(e.target.checked)}
/>
{/* 32. Tooltip */}
Top
Bottom
Left
Right
)
}