Default
import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function Default() {
return <PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" />;
}Design-token preview tile that renders a CSS custom property as a color sample alongside its human name and variable identifier.
import { PixelColorSwatch } from '@pxlkit/ui-kit';| Prop | Type | Default | Description |
|---|---|---|---|
name (required) | string | — | Display name for the token (e.g. "Cyan 500"). |
cssVar (required) | string | — | CSS variable to preview (e.g. "--retro-cyan"). |
surface | 'pixel' | 'linear' | — | Visual surface override. |
WCAG target: 2.1 AA
imgNon-interactive presentational block. The visible token name + cssVar string provide the textual description of the color sample for screen readers; no separate alt text is required because the chip itself carries no semantic meaning beyond the adjacent label.
import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function Default() {
return <PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" />;
}import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function Default() {
return <PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" />;
}import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function Palette() {
return (
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3 max-w-xl">
<PixelColorSwatch name="green" cssVar="--color-retro-green" />
<PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" />
<PixelColorSwatch name="gold" cssVar="--color-retro-gold" />
<PixelColorSwatch name="purple" cssVar="--color-retro-purple" />
<PixelColorSwatch name="red" cssVar="--color-retro-red" />
<PixelColorSwatch name="pink" cssVar="--color-retro-pink" />
</div>
);
}import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function Surfaces() {
return (
<div className="flex flex-col gap-4">
<PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" surface="pixel" />
<PixelColorSwatch name="cyan" cssVar="--color-retro-cyan" surface="linear" />
</div>
);
}import { PixelColorSwatch } from '@pxlkit/ui-kit';
export function SurfaceTokens() {
return (
<div className="grid grid-cols-2 gap-3 max-w-md">
<PixelColorSwatch name="surface" cssVar="--color-retro-surface" />
<PixelColorSwatch name="border" cssVar="--color-retro-border" />
<PixelColorSwatch name="text" cssVar="--color-retro-text" />
<PixelColorSwatch name="muted" cssVar="--color-retro-muted" />
</div>
);
}