design-guide
Provides guidelines for creating consistent and reusable UI components in the Paperclip design system.
Pass rate with the skill minus without, same tasks, same model.
- Content Lift forced arm
- +13pp [0, +38]
- Trigger rate
- 100%
- Trials
- 24 · 8 tasks
- Model
- GLM-5.3-flash
- Measured
- 2026-10-15
Content Lift = the skill's instructions injected into the system prompt, so it measures what the content does once loaded, apart from whether the agent chooses to load it. Method →
Embed this score · live badge for your README
The badge shows the real benchmark number and updates itself when we re-bench — including the honest states (“did not trigger”, “not benched yet”). All badge options →
[](https://skillzbench.com/skills/design-guide)[](https://skillzbench.com/skills/design-guide)<a href="https://skillzbench.com/skills/design-guide"><img src="https://skillzbench.com/api/badge/design-guide.svg" alt="SkillzBench benchmark" height="20"></a>A/B outputs — median trial per arm
Chat harness (v2): the agent's final message without the skill (left) vs with it (right).
design-guide--m1
type Variant = 'primary' | 'secondary' | 'danger' | 'ghost';
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: Variant;
size?: 'sm' | 'md' | 'lg';
}
Variant styles (CSS-in-JS / style object style):
const variantStyles: Record<Variant, React.CSSProperties> = {
primary: {
background: 'var(--color-accent)',
color: 'var(--color-text-on-accent)',
border: '1px solid transparent',
},
secondary: {
background: 'transparent',
color: 'var(--color-text-secondary)',
border: '1px solid var(--color-border-subtle)',
},
danger: {
background: 'var(--color-danger)',
color: 'var(--color-text-on-danger)',
border: '1px solid transparent',
},
ghost: {
background: 'transparent',
color: 'var(--color-text-secondary)',
border: '1px solid transparent',
},
};
// Hover state for ghost — subtle background, no border shift
const ghostHover = {
background: 'var(--color-bg-subtle)',
};
If you're using plain CSS instead:
.btn--ghost {
background: transparent;
color: var(--color-text-secondary);
border: 1px solid transparent;
}
.btn--ghost:hover {
background: var(--color-bg-subtle);
}
Usage example — table row action menu:
function RowActions({ user }: { user: User }) {
return (
<div style={{ display: 'flex', gap: 4 }}>
<Button variant="ghost" size="sm" onClick={() => openEdit(user)}>
Edit
</Button>
<Button variant="ghost" size="sm" onClick={() => openDelete(user)}>
Delete
</Button>
</div>
);
}
When NOT to use ghost:
- Primary or destructive standalone actions — e.g., a "Delete" confirm button in a dialog should be
danger, not ghost; ghost de-emphasizes irreversible actions. - The main CTA on a page or modal — ghost has the lowest visual weight; use
primaryso users can find the key action. - On busy or image-heavy backgrounds — the transparent background and subtle hover token assume a plain surface; ghost can become invisible or illegible.
- As the only affordance for a critical flow — if ghost is the sole entry point to something important (checkout, submit), discoverability suffers.
- Inside other interactive elements — never nest a ghost button inside a clickable row/card; it creates nested interactivity and confusing hit targets.
(no text deliverable)
design-guide--m2
StatusBadge Component
import React from 'react';
type Status = 'Backlog' | 'In Progress' | 'Blocked' | 'Done';
const STATUS_CONFIG: Record<
Status,
{ color: 'gray' | 'blue' | 'red' | 'green'; label: string }
> = {
'Backlog': { color: 'gray', label: 'Backlog' },
'In Progress': { color: 'blue', label: 'In progress' },
'Blocked': { color: 'red', label: 'Blocked' },
'Done': { color: 'green', label: 'Done' },
};
interface StatusBadgeProps {
status: Status;
count?: number;
size?: 'sm' | 'md';
}
export function StatusBadge({ status, count, size = 'md' }: StatusBadgeProps) {
const { color, label } = STATUS_CONFIG[status];
const dotVar = `var(--status-${STATUS_CONFIG[status].color})`;
return (
<Badge color={color} size={size}>
<span
aria-hidden="true"
style={{
width: size === 'sm' ? 6 : 8,
height: size === 'sm' ? 6 : 8,
borderRadius: '50%',
backgroundColor: dotVar,
flexShrink: 0,
}}
/>
{label}
{count !== undefined && (
<span style={{ opacity: 0.75 }}>· {count}</span>
)}
</Badge>
);
}
The Badge component should use the soft background variants for its background, e.g. background: var(--status-backlog-soft) when color="gray", and color: var(--status-backlog) for text — so each status maps to its token pair automatically.
Status → Color Mapping
| Status | Badge color | Dot color token | Soft background token |
|---|---|---|---|
| Backlog | gray | --status-backlog | --status-backlog-soft |
| In Progress | blue | --status-progress | --status-progress-soft |
| Blocked | red | --status-blocked | --status-blocked-soft |
| Done | green | --status-done | --status-done-soft |
Accessibility Guidance
- Don't rely on color alone. The dot is decorative (
aria-hidden="true"); the status is always conveyed by the visible text label, so color-blind users get the same information. - Screen readers: the accessible name is just the label (e.g., "In progress, 12"). If the count is meaningful, render it as text (as above) rather than a visual-only suffix. Optionally use
aria-label={${label}: ${count} issues}when the count needs clarification. - Contrast: ensure text on the soft background meets WCAG 2.1 AA (4.5:1 for normal text, 3:1 for large/bold text). If a soft token is too light for gray text, darken the text color or use the solid token for text only.
- Dot size: keep the dot ≥ 6px and pair it with the text label — it's an enhancement, not the sole indicator.
- Interactive badges: if the badge is clickable (e.g., filters by status), make it a real
<button>with a focus-visible ring, not a styled<span>.
// ui/src/components/StatusBadge.tsx
import { cn } from "@/lib/utils";
export type IssueStatus = "Backlog" | "In Progress" | "Blocked" | "Done";
const STATUS_CONFIG: Record<
IssueStatus,
{ color: "gray" | "blue" | "red" | "green"; label: string }
> = {
Backlog: { color: "gray", label: "Backlog" },
"In Progress": { color: "blue", label: "In Progress" },
Blocked: { color: "red", label: "Blocked" },
Done: { color: "green", label: "Done" },
};
interface StatusBadgeProps {
status: IssueStatus;
count?: number;
size?: "sm" | "md";
className?: string;
}
export function StatusBadge({ status, count, size = "md", className }: StatusBadgeProps) {
const { color, label } = STATUS_CONFIG[status];
return (
<span
role="status"
aria-label={`${label}${count !== undefined ? `, ${count} issues` : ""}`}
className={cn(
"inline-flex items-center gap-1.5 rounded-full font-medium",
"bg-(--status-" + color + "-soft) text-(--status-" + color + ")",
size === "sm" ? "px-2 py-0.5 text-xs" : "px-2.5 py-1 text-sm",
className
)}
>
<span
aria-hidden="true"
className={cn(
"rounded-full bg-(--status-" + color + ")",
size === "sm" ? "size-1.5" : "size-2"
)}
/>
{label}
{count !== undefined && (
<span className="font-mono text-muted-foreground">{count}</span>
)}
</span>
);
}
Note: if your Tailwind setup can't resolve dynamic bg-(--status-...) values, use a static variant map instead:
const VARIANTS = {
gray: "bg-(--status-backlog-soft) text-(--status-backlog)",
blue: "bg-(--status-progress-soft) text-(--status-progress)",
red: "bg-(--status-blocked-soft) text-(--status-blocked)",
green: "bg-(--status-done-soft) text-(--status-done)",
} as const;
Status mapping table
| Status | Badge color | Dot color | Soft background |
|---|---|---|---|
| Backlog | --status-backlog (gray) | gray | --status-backlog-soft |
| In Progress | --status-progress (blue) | blue | --status-progress-soft |
| Blocked | --status-blocked (red) | red | --status-blocked-soft |
| Done | --status-done (green) | green | --status-done-soft |
Accessible label guidance
- The badge has
role="status"and an explicitaria-labellike "In Progress, 3 issues" — screen readers announce a complete sentence, not just the color. - The dot is
aria-hidden="true"— color alone never carries meaning; the status text is always present. - The count is included in the label so users don't hear an unexplained number.
- Don't rely on color to distinguish statuses (e.g., in dense tables) — the text label is always rendered.
- If the badge is purely decorative next to an already-labeled group header, you can pass
aria-hiddenon the wrapper instead to avoid duplicate announcements.
design-guide--m3
Settings Page
function SettingsPage() {
return (
<div className="page">
<header className="page-header">
<h1 className="type-display">Settings</h1>
</header>
<main className="page-content">
{/* Profile */}
<section className="settings-section" aria-labelledby="profile-heading">
<h2 id="profile-heading" className="type-title">Profile</h2>
<Field label="Name" htmlFor="settings-name">
<Input
id="settings-name"
type="text"
defaultValue="Ada Lovelace"
/>
</Field>
<Field label="Email" htmlFor="settings-email">
<Input
id="settings-email"
type="email"
defaultValue="ada@example.com"
/>
</Field>
</section>
{/* Notifications */}
<section className="settings-section" aria-labelledby="notifications-heading">
<h2 id="notifications-heading" className="type-title">Notifications</h2>
<Toggle
label="Email notifications"
description="Receive product updates and digests by email."
defaultChecked
/>
<Toggle
label="Marketing emails"
description="Occasional offers and announcements."
/>
</section>
{/* Danger Zone */}
<section className="settings-section settings-section--danger" aria-labelledby="danger-heading">
<h2 id="danger-heading" className="type-title">Danger Zone</h2>
<p className="type-body">
Permanently delete your account and all associated data. This action cannot be undone.
</p>
<Button variant="danger" onClick={handleDeleteAccount}>
Delete account
</Button>
</section>
</main>
</div>
);
}
How the sections are composed
-
Standard layout — The page wraps everything in
div.page, with the page title (type-display, 28px/600) inheader.page-headerand all interactive content inmain.page-content. Each section is a<section>with anaria-labelledbypointing at its heading for accessibility. -
Profile — Uses
Fieldas the labeled wrapper around eachInput.Fieldsupplies the visible label (type-label, 12px/500) and wireshtmlForto the input'sid, so the composition is:Field → Input, one pair per attribute. -
Notifications —
Toggleis self-labeling, so noFieldwrapper is needed; each toggle carries its own label (type-body) and optional description. The two toggles are independent boolean settings, so they're siblings rather than grouped inputs. -
Danger Zone — Follows the same section pattern but with a
--dangermodifier class for visual separation (e.g., red-tinted border). It pairs atype-bodyexplanatory paragraph with a destructiveButton variant="danger". The destructive action is deliberately isolated in its own section so it can't be confused with routine settings. -
Typography mapping —
type-displayfor the page title,type-titlefor each section heading,type-bodyfor descriptions/help text, andtype-label(applied insideField) for form labels.
Settings Page
import { useState } from "react";
import { Field, Input, Select, Toggle, Button } from "@/components/ui";
type Typography = "display" | "title" | "body" | "label";
// Assume these resolve to the typography tokens:
// display → 28px/600, title → 20px/600, body → 14px/400, label → 12px/500
export function SettingsPage() {
const [name, setName] = useState("Ada Lovelace");
const [email, setEmail] = useState("ada@example.com");
const [role, setRole] = useState("admin");
const [emailDigest, setEmailDigest] = useState(true);
const [productUpdates, setProductUpdates] = useState(false);
return (
<div className="page">
<header className="page-header">
<h1 className="text-display">Settings</h1>
<p className="text-body text-muted">Manage your account and preferences.</p>
</header>
<main className="page-content">
{/* ── Profile ─────────────────────────────── */}
<section className="settings-section" aria-labelledby="profile-heading">
<h2 id="profile-heading" className="text-title">Profile</h2>
<div className="settings-section-body">
<Field label="Name" htmlFor="settings-name">
<Input
id="settings-name"
value={name}
onChange={(e) => setName(e.target.value)}
/>
</Field>
<Field label="Email" htmlFor="settings-email">
<Input
id="settings-email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
</Field>
<Field label="Role" htmlFor="settings-role">
<Select
id="settings-role"
value={role}
onChange={(e) => setRole(e.target.value)}
options={[
{ value: "admin", label: "Admin" },
{ value: "member", label: "Member" },
{ value: "viewer", label: "Viewer" },
]}
/>
</Field>
<div className="settings-actions">
<Button variant="primary" onClick={saveProfile}>Save changes</Button>
<Button variant="ghost" onClick={resetProfile}>Cancel</Button>
</div>
</div>
</section>
{/* ── Notifications ───────────────────────── */}
<section className="settings-section" aria-labelledby="notifications-heading">
<h2 id="notifications-heading" className="text-title">Notifications</h2>
<div className="settings-section-body">
<Toggle
label="Weekly email digest"
description="A summary of activity sent every Monday."
checked={emailDigest}
onChange={setEmailDigest}
/>
<Toggle
label="Product updates"
description="Occasional announcements about new features."
checked={productUpdates}
onChange={setProductUpdates}
/>
</div>
</section>
{/* ── Danger Zone ─────────────────────────── */}
<section className="settings-section settings-section--danger" aria-labelledby="danger-heading">
<h2 id="danger-heading" className="text-title">Danger Zone</h2>
<div className="settings-section-body">
<p className="text-body text-muted">
Permanently delete your account and all associated data. This action cannot be undone.
</p>
<Button variant="destructive" onClick={confirmDeleteAccount}>
Delete account
</Button>
</div>
</section>
</main>
</div>
);
}
How the sections are composed
Page shell. The standard page → page-header → page-content layout is used verbatim. The header carries the page title at the display token (28px/600) with a body-token subtitle; page-content stacks the three sections vertically.
Section pattern (repeated three times). Each section follows the same composition:
<section>with anaria-labelledbypointing at its heading — keeps the page accessible and lets you style sections uniformly via a shared class.- A
title-token (20px/600) heading. - A
settings-section-bodywrapper holding the section's controls, so spacing between sections vs. within a section is controlled independently.
Profile composes Field + Input/Select. Field owns the label-token (12px/500) label and error slot; the controls stay unstyled so the primitives remain reusable. Actions live in a footer row: primary Button for save, ghost for cancel.
Notifications composes Toggle twice. Each toggle pairs a body-token label with a body/muted description, so the section reads as a list without extra headings. State is simple booleans lifted to the page.
Danger Zone reuses the same section pattern but adds a modifier class (settings-section--danger) for a destructive border/accent, a body-token warning paragraph, and a single variant="destructive" Button. In production, confirmDeleteAccount should open a confirmation dialog rather than deleting directly.
Why this structure: the three sections are intentionally not a loop or a SettingsSection component — the content differs enough (form vs. toggles vs. single action) that abstraction would add indirection without reuse. The shared CSS classes (settings-section, settings-section-body) carry the consistency instead, keeping the JSX declarative and each section independently editable.
design-guide--m4
// Chip.tsx
import React from "react";
import "./Chip.css";
export interface ChipProps {
label: string;
onDismiss?: () => void;
}
export const Chip: React.FC<ChipProps> = ({ label, onDismiss }) => (
<span className="chip">
<span className="chip__label">{label}</span>
{onDismiss && (
<button
type="button"
className="chip__dismiss"
onClick={onDismiss}
aria-label={`Dismiss ${label}`}
>
✕
</button>
)}
</span>
);
/* Chip.css */
.chip {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1) var(--space-2);
background: var(--color-bg);
border: 1px solid var(--color-secondary);
border-radius: var(--radius-full);
font-size: var(--font-size-sm);
color: var(--color-primary);
}
.chip__label {
line-height: 1;
}
.chip__dismiss {
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
padding: 0;
border: none;
border-radius: var(--radius-full);
background: transparent;
color: var(--color-secondary);
font-size: var(--font-size-sm);
line-height: 1;
cursor: pointer;
}
.chip__dismiss:hover {
color: var(--color-primary);
}
Usage:
<Chip label="Design" onDismiss={() => remove("design")} />
<Chip label="Read-only" />
Chip.tsx
import "./Chip.css";
export interface ChipProps {
label: string;
onDismiss?: () => void;
}
export function Chip({ label, onDismiss }: ChipProps) {
return (
<span className="chip">
<span className="chip-label">{label}</span>
{onDismiss && (
<button
type="button"
className="chip-dismiss"
aria-label={`Remove ${label}`}
onClick={onDismiss}
>
×
</button>
)}
</span>
);
}
Chip.css
.chip {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1) var(--space-2);
background: var(--color-bg);
border: 1px solid var(--color-secondary);
border-radius: var(--radius-full);
font-size: var(--font-size-sm);
color: var(--color-secondary);
line-height: 1.2;
}
.chip-label {
white-space: nowrap;
}
.chip-dismiss {
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
padding: 0;
border: none;
border-radius: var(--radius-full);
background: transparent;
color: var(--color-secondary);
font-size: var(--font-size-sm);
line-height: 1;
cursor: pointer;
}
.chip-dismiss:hover {
background: var(--color-secondary);
color: var(--color-bg);
}
.chip-dismiss:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: 1px;
}
Usage
<Chip label="Design" />
<Chip label="Active" onDismiss={() => remove("Active")} />
Notes:
onDismissomitted → renders as a static chip; provided → shows the × button.- Dismiss button has an
aria-labeland a visible focus ring using--color-primaryfor accessibility. - All styling comes from the tokens you supplied — no hardcoded values.
design-guide--m5
ToggleSwitch Component
ToggleSwitch.jsx
import React, { useId } from "react";
import "./ToggleSwitch.css";
/**
* ToggleSwitch
*
* @param {string} label - Visible label text.
* @param {boolean} checked - Controlled checked state.
* @param {boolean} disabled - Disables interaction.
* @param {function} onChange - Called with the new checked boolean.
*/
export default function ToggleSwitch({
label,
checked = false,
disabled = false,
onChange,
}) {
const inputId = useId();
const handleChange = (e) => {
if (!disabled) onChange(e.target.checked);
};
return (
<label
className={`toggle-switch${disabled ? " toggle-switch--disabled" : ""}`}
htmlFor={inputId}
>
{/* Visually hidden checkbox — still keyboard/screen-reader accessible */}
<input
id={inputId}
type="checkbox"
className="toggle-switch__input"
checked={checked}
disabled={disabled}
onChange={handleChange}
/>
<span className="toggle-switch__track" aria-hidden="true">
<span className="toggle-switch__thumb" />
</span>
<span className="toggle-switch__label">{label}</span>
</label>
);
}
ToggleSwitch.css
.toggle-switch {
display: inline-flex;
align-items: center;
gap: var(--space-3);
cursor: pointer;
user-select: none;
}
.toggle-switch--disabled {
cursor: not-allowed;
opacity: 0.5;
}
/* Visually hidden, but focusable and announced to screen readers */
.toggle-switch__input {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
.toggle-switch__track {
position: relative;
flex-shrink: 0;
width: 40px;
height: 22px;
border-radius: var(--radius-full);
background-color: var(--color-bg);
border: 1px solid var(--color-border);
transition: background-color var(--transition-fast),
border-color var(--transition-fast);
}
.toggle-switch__thumb {
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
border-radius: var(--radius-full);
background-color: #ffffff;
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
transition: transform var(--transition-fast);
}
/* Checked state */
.toggle-switch__input:checked + .toggle-switch__track {
background-color: var(--color-primary);
border-color: var(--color-primary);
}
.toggle-switch__input:checked + .toggle-switch__track .toggle-switch__thumb {
transform: translateX(18px);
}
/* Focus ring for keyboard users */
.toggle-switch__input:focus-visible + .toggle-switch__track {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
.toggle-switch__label {
font-size: var(--font-size-sm);
color: inherit;
}
Usage
const [enabled, setEnabled] = useState(false);
<ToggleSwitch
label="Email notifications"
checked={enabled}
onChange={(checked) => setEnabled(checked)}
/>
<ToggleSwitch
label="Premium feature"
checked={true}
disabled={true}
onChange={() => {}}
/>
Notes:
- The real
<input type="checkbox">is visually hidden but remains fully keyboard-operable (Space toggles it) and screen-reader accessible; the styled track/thumb is purely decorative (aria-hidden). useId()guarantees unique input/label association across instances.- All styling uses your design tokens; the checked state animates the thumb via
transformwith--transition-fast.
Here's a self-contained ToggleSwitch using your tokens:
ToggleSwitch.jsx
import React, { useId } from "react";
import "./ToggleSwitch.css";
export default function ToggleSwitch({
label,
checked,
defaultChecked = false,
disabled = false,
onChange,
}) {
const id = useId();
const isControlled = checked !== undefined;
const [internalChecked, setInternalChecked] = React.useState(defaultChecked);
const isChecked = isControlled ? checked : internalChecked;
const handleChange = (e) => {
const next = e.target.checked;
if (!isControlled) setInternalChecked(next);
onChange?.(next);
};
return (
<div className="toggle-switch">
<input
id={id}
type="checkbox"
className="toggle-switch__input"
checked={isChecked}
disabled={disabled}
onChange={handleChange}
/>
<label htmlFor={id} className="toggle-switch__track" aria-hidden="true">
<span className="toggle-switch__thumb" />
</label>
<label htmlFor={id} className="toggle-switch__label">
{label}
</label>
</div>
);
}
ToggleSwitch.css
.toggle-switch {
display: inline-flex;
align-items: center;
gap: var(--space-3);
}
/* Visually hidden, still focusable/accessible */
.toggle-switch__input {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.toggle-switch__track {
position: relative;
display: inline-block;
width: 40px;
height: 22px;
flex-shrink: 0;
background: var(--color-border);
border-radius: var(--radius-full);
cursor: pointer;
transition: background var(--transition-fast);
}
.toggle-switch__thumb {
position: absolute;
top: 2px;
left: 2px;
width: 18px;
height: 18px;
background: #fff;
border-radius: var(--radius-full);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
transition: transform var(--transition-fast);
}
/* Checked */
.toggle-switch__input:checked + .toggle-switch__track {
background: var(--color-primary);
}
.toggle-switch__input:checked + .toggle-switch__track .toggle-switch__thumb {
transform: translateX(18px);
}
/* Disabled */
.toggle-switch__input:disabled + .toggle-switch__track {
opacity: 0.5;
cursor: not-allowed;
}
.toggle-switch__input:disabled ~ .toggle-switch__label {
color: var(--color-border);
cursor: not-allowed;
}
/* Label */
.toggle-switch__label {
font-size: var(--font-size-sm);
cursor: pointer;
user-select: none;
}
/* Focus ring on keyboard focus */
.toggle-switch__input:focus-visible + .toggle-switch__track {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
Usage
<ToggleSwitch
label="Email notifications"
checked={enabled}
onChange={(next) => setEnabled(next)}
/>
<ToggleSwitch label="Disabled option" disabled defaultChecked />
Notes:
- Works both controlled (
checked+onChange) and uncontrolled (defaultChecked). - The real
<input type="checkbox">is visually hidden but remains keyboard-focusable and screen-reader accessible; the styled track/thumb is purely decorative (aria-hidden), and clicking the label toggles via the native label/for association. :focus-visiblering uses the primary color for keyboard users; disabled state dims the track and label.
- Results are for the SkillzBench reference agent on GLM-5.3-flash. Switch models above — a skill can help one model and not another.
- Screen tier (1 trial per arm) is directional. Verified needs a full-tier run (≥ 8 tasks, ≥ 3 trials per arm) with the CI excluding zero.
- Task coverage: 8 generated tasks for this skill's category; a skill can shine elsewhere.