import * as stylex from "@stylexjs/stylex";
import { useCallback, useId, useMemo, useState } from "react";
import { Alert } from "#components/ui/ui-sdk/alert.tsx";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Breadcrumb } from "#components/ui/ui-sdk/breadcrumb.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Card } from "#components/ui/ui-sdk/card.tsx";
import { Code } from "#components/ui/ui-sdk/code.tsx";
import { CodeBlock } from "#components/ui/ui-sdk/code-block.tsx";
import { Grid } from "#components/ui/ui-sdk/grid.tsx";
import { Heading } from "#components/ui/ui-sdk/heading.tsx";
import { Icon } from "#components/ui/ui-sdk/icon.tsx";
import { IconButton } from "#components/ui/ui-sdk/icon-button.tsx";
import { Kbd } from "#components/ui/ui-sdk/kbd.tsx";
import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";
import { Separator } from "#components/ui/ui-sdk/separator.tsx";
import { Spinner } from "#components/ui/ui-sdk/spinner.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Switch } from "#components/ui/ui-sdk/switch.tsx";
import { Table } from "#components/ui/ui-sdk/table.tsx";
import { Tabs } from "#components/ui/ui-sdk/tabs.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";
import { Toc, type TocItemData } from "#components/ui/ui-sdk/toc.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";
import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";
import {
accentPalette,
amberPalette,
bluePalette,
emeraldPalette,
redPalette,
} from "@stylexblocks/ui/themes/palettes.ts";
import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";
import { fontSizes } from "@stylexblocks/ui/tokens/font-sizes.stylex.ts";
import { fontWeights } from "@stylexblocks/ui/tokens/font-weights.stylex.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";
import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";
import { sizes } from "@stylexblocks/ui/tokens/sizes.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";
// ---------------------------------------------------------------------------
// Types
// ---------------------------------------------------------------------------
export type PlaygroundVariant = "solid" | "surface" | "outline" | "subtle" | "ghost";
export type PlaygroundSize = "xs" | "sm" | "md" | "lg";
export type PlaygroundTone = "accent" | "neutral" | "destructive";
export type PropCategory = "all" | "visual" | "behavior" | "a11y";
export interface ComponentPropSpec {
name: string;
type: string;
defaultValue: string;
category: Exclude<PropCategory, "all">;
required?: boolean;
description: string;
}
export interface KeyboardContractRow {
keys: readonly string[];
action: string;
scope: string;
}
export interface AdjacentArticleLink {
slug: string;
title: string;
section: string;
}
export interface DocumentationDesignProps extends StyleOverrideProps {
/** Component title displayed in the article hero. */
componentName?: string;
/** Design system label displayed in breadcrumbs and metadata. */
systemName?: string;
/** Package version badge text. */
version?: string;
/** Package import path shown in copyable import strips. */
packageName?: string;
/** Last updated timestamp text. */
updatedLabel?: string;
/** Custom API prop definitions rendered in the Props table. */
propSpecs?: readonly ComponentPropSpec[];
/** Custom keyboard accessibility contract rows. */
keyboardRows?: readonly KeyboardContractRow[];
/** Callback fired when a user clicks Previous or Next article cards. */
onNavigateArticle?: (article: AdjacentArticleLink) => void;
/** Callback fired when a user submits page helpfulness feedback. */
onFeedback?: (helpful: boolean) => void;
}
// ---------------------------------------------------------------------------
// Original Demo Data — Solstice Design System v3.4
// ---------------------------------------------------------------------------
const SECTION_DEFS = [
{ slug: "playground", label: "Interactive playground", depth: 2 },
{ slug: "variants", label: "Emphasis & variants", depth: 2 },
{ slug: "split-trigger", label: "Split trigger pattern", depth: 3 },
{ slug: "guidelines", label: "Do & Don't guidelines", depth: 2 },
{ slug: "api-props", label: "API & props", depth: 2 },
{ slug: "recipes", label: "Usage recipes", depth: 2 },
{ slug: "accessibility", label: "Keyboard & ARIA", depth: 2 },
] as const;
const DEFAULT_PROP_SPECS: readonly ComponentPropSpec[] = [
{
name: "variant",
type: '"solid" | "surface" | "outline" | "subtle" | "ghost"',
defaultValue: '"surface"',
category: "visual",
description:
"Controls surface prominence. Reserve solid for a single primary commitment per view or dialog.",
},
{
name: "size",
type: '"xs" | "sm" | "md" | "lg"',
defaultValue: '"md"',
category: "visual",
description:
"Sets control height, horizontal padding, and icon scale using Solstice spacing tokens.",
},
{
name: "tone",
type: '"accent" | "neutral" | "destructive"',
defaultValue: '"neutral"',
category: "visual",
description:
"Applies semantic color intent. Pair destructive with confirmation dialogs for irreversible actions.",
},
{
name: "loading",
type: "boolean",
defaultValue: "false",
category: "behavior",
description:
"Displays an inline Spinner, sets aria-busy, and blocks duplicate submissions while preserving button width.",
},
{
name: "loadingText",
type: "string",
defaultValue: "undefined",
category: "behavior",
description:
"Optional status label announced to screen readers and shown beside the spinner while loading.",
},
{
name: "disabled",
type: "boolean",
defaultValue: "false",
category: "behavior",
description:
"Prevents activation and reduces contrast. Avoid disabling without explaining why the action is unavailable.",
},
{
name: "leadingIcon",
type: "ReactNode",
defaultValue: "undefined",
category: "visual",
description:
"Decorative 16px SVG icon rendered before the label with aria-hidden applied automatically.",
},
{
name: "splitMenu",
type: "boolean",
defaultValue: "false",
category: "behavior",
description:
"Attaches a secondary chevron menu trigger sharing height, border radius, and tone for alternate commit modes.",
},
{
name: "onPress",
type: "() => void | Promise<void>",
defaultValue: "undefined",
category: "behavior",
required: true,
description:
"Activation handler. Returning a Promise automatically enters the pending state until settled.",
},
{
name: "render",
type: "ReactElement",
defaultValue: "<button />",
category: "a11y",
description:
"Replaces the host element (for example, an anchor tag) while preserving focus ring and keyboard semantics.",
},
{
name: "aria-label",
type: "string",
defaultValue: "undefined",
category: "a11y",
description:
"Required for icon-only buttons and split menu triggers so assistive technologies announce an explicit verb.",
},
];
const DEFAULT_KEYBOARD_ROWS: readonly KeyboardContractRow[] = [
{
keys: ["Tab"],
action: "Moves keyboard focus to the primary button, then to the attached split menu trigger.",
scope: "Global focus ring",
},
{
keys: ["Shift", "Tab"],
action: "Moves focus backward across the button group without trapping navigation.",
scope: "Global focus ring",
},
{
keys: ["Enter"],
action: "Activates the focused button immediately or submits the enclosing form.",
scope: "Primary & split trigger",
},
{
keys: ["Space"],
action: "Activates on key release, matching native button behavior and preventing page scroll.",
scope: "Primary & split trigger",
},
{
keys: ["ArrowDown"],
action: "Opens the attached split menu and moves focus directly to the first menu item.",
scope: "Split trigger only",
},
{
keys: ["Esc"],
action: "Dismisses an open split menu and restores focus cleanly to the chevron trigger.",
scope: "Open split menu",
},
];
const ARIA_CHECKLIST = [
{
attr: 'type="button"',
detail: "Defaults to non-submitting inside forms unless explicitly declared as submit.",
},
{
attr: 'aria-busy="true"',
detail: "Applied automatically during loading states alongside a polite live-region update.",
},
{
attr: 'aria-haspopup="menu"',
detail: "Paired with aria-expanded on the split trigger chevron to describe the attached menu.",
},
{
attr: 'aria-disabled="true"',
detail: "Prefer over native disabled during async commits so focus stays anchored on the control.",
},
] as const;
const RECIPE_SNIPPETS = {
async: {
filename: "DeployButton.tsx",
code: `import { ActionButton } from "@solstice-ui/action-button";
export function DeployButton({ onDeploy }: { onDeploy: () => Promise<void> }) {
return (
<ActionButton
variant="solid"
tone="accent"
size="md"
loadingText="Deploying release…"
onPress={onDeploy}
>
Deploy release
</ActionButton>
);
}`,
},
split: {
filename: "PublishSplitTrigger.tsx",
code: `import { ActionButton, SplitTriggerGroup } from "@solstice-ui/action-button";
export function PublishSplitTrigger() {
return (
<SplitTriggerGroup tone="accent" variant="solid" size="md">
<ActionButton onPress={() => publish("production")}>
Publish v3.4
</ActionButton>
<ActionButton
aria-label="More publish targets"
aria-haspopup="menu"
onPress={() => openTargetMenu()}
/>
</SplitTriggerGroup>
);
}`,
},
compose: {
filename: "NavigationAction.tsx",
code: `import { ActionButton } from "@solstice-ui/action-button";
export function NavigationAction() {
return (
<ActionButton
variant="outline"
size="sm"
render={<a href="/releases/v3.4" />}
>
View release notes
</ActionButton>
);
}`,
},
install: {
filename: "terminal",
code: `# Install the Solstice Action Button package
bun add @solstice-ui/action-button
# Import semantic tokens alongside the component
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";`,
},
} as const;
const EMPHASIS_SNIPPET = `<ActionButton variant="solid" tone="accent">Publish</ActionButton>
<ActionButton variant="surface">Save draft</ActionButton>
<ActionButton variant="outline">Preview</ActionButton>
<ActionButton variant="subtle" tone="accent">Duplicate</ActionButton>
<ActionButton variant="ghost">Cancel</ActionButton>
<ActionButton variant="solid" tone="destructive">Archive</ActionButton>`;
const SPLIT_SNIPPET = `<div role="group" aria-label="Release publish actions">
<ActionButton variant="solid" tone="accent">Publish v3.4</ActionButton>
<ActionButton
variant="solid"
tone="accent"
aria-label="Choose publish schedule"
aria-haspopup="menu"
aria-expanded={menuOpen}
/>
</div>`;
const PREV_ARTICLE: AdjacentArticleLink = {
slug: "badge-status-pill",
title: "Badge & Status Pill",
section: "Components · Feedback",
};
const NEXT_ARTICLE: AdjacentArticleLink = {
slug: "dialog-confirmation-sheet",
title: "Dialog & Confirmation Sheet",
section: "Components · Overlays",
};
const SPLIT_MENU_OPTIONS = [
{ id: "prod", label: "Publish to production", hint: "Immediate rollout" },
{ id: "canary", label: "Deploy 10% canary", hint: "EU & US-East PoPs" },
{ id: "schedule", label: "Schedule for 09:00 UTC", hint: "Maintenance window" },
] as const;
// ---------------------------------------------------------------------------
// Inline SVG Icons (zero external icon libraries)
// ---------------------------------------------------------------------------
function ChevronRightIcon() {
return (
<Icon
size="xs"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m6 3.5 4.5 4.5L6 12.5" />
</Icon>
);
}
function ChevronDownIcon() {
return (
<Icon
size="xs"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m3.5 6 4.5 4.5L12.5 6" />
</Icon>
);
}
function CopyIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<rect x="7" y="7" width="9" height="9" rx="1.75" />
<path d="M4 13V5.5A1.5 1.5 0 0 1 5.5 4H13" />
</Icon>
);
}
function CheckIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.85"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m5 10.5 3.2 3.2L15.5 6.5" />
</Icon>
);
}
function XMarkIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.85"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M5.5 5.5 14.5 14.5" />
<path d="M14.5 5.5 5.5 14.5" />
</Icon>
);
}
function RocketLaunchIcon() {
return (
<Icon
size="sm"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M11.5 8.5 16 4c.4 3.4-.9 6.5-3.3 8.8l-1.7 1.7-3.5-3.5 1.7-1.7Z" />
<path d="M7.5 11 4.5 11.5 3.5 16.5l5-1 .5-3" />
<circle cx="12.5" cy="7.5" r="1" />
</Icon>
);
}
function ResetIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.7"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M4.5 10a5.5 5.5 0 1 0 1.4-3.65" />
<path d="M4.5 4.25v2.75h2.75" />
</Icon>
);
}
function InfoCircleIcon() {
return (
<Icon
size="sm"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<circle cx="10" cy="10" r="7.25" />
<path d="M10 9.25v4.25" />
<path d="M10 6.5h.01" />
</Icon>
);
}
function WarningTriangleIcon() {
return (
<Icon
size="sm"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M8.85 3.65 2.4 14.8A1.3 1.3 0 0 0 3.53 16.75h12.94a1.3 1.3 0 0 0 1.13-1.95L11.15 3.65a1.3 1.3 0 0 0-2.3 0Z" />
<path d="M10 7.75v3.5" />
<path d="M10 14h.01" />
</Icon>
);
}
function ThumbUpIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M6.5 9.25V16H4.25A1.25 1.25 0 0 1 3 14.75v-4.25A1.25 1.25 0 0 1 4.25 9.25H6.5Z" />
<path d="M6.5 9.25 9.3 3.8a1.15 1.15 0 0 1 2.15.55V7.5h3.75a1.5 1.5 0 0 1 1.47 1.8l-.9 4.5A2 2 0 0 1 13.8 15.5H6.5" />
</Icon>
);
}
function ThumbDownIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M6.5 10.75V4H4.25A1.25 1.25 0 0 0 3 5.25V9.5a1.25 1.25 0 0 0 1.25 1.25H6.5Z" />
<path d="M6.5 10.75 9.3 16.2a1.15 1.15 0 0 0 2.15-.55V12.5h3.75a1.5 1.5 0 0 0 1.47-1.8l-.9-4.5A2 2 0 0 0 13.8 4.5H6.5" />
</Icon>
);
}
function ArrowLeftIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M15.5 10h-11" />
<path d="M9 5.5 4.5 10 9 14.5" />
</Icon>
);
}
function ArrowRightIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M4.5 10h11" />
<path d="M11 5.5 15.5 10 11 14.5" />
</Icon>
);
}
function TrashIcon() {
return (
<Icon
size="xs"
viewBox="0 0 20 20"
fill="none"
stroke="currentColor"
strokeWidth="1.65"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M4.5 5.75h11" />
<path d="M8 3.75h4" />
<path d="M6 5.75v9.5A1.5 1.5 0 0 0 7.5 16.75h5a1.5 1.5 0 0 0 1.5-1.5v-9.5" />
</Icon>
);
}
// ---------------------------------------------------------------------------
// Styles (StyleX longhand properties + named @container queries)
// ---------------------------------------------------------------------------
const NARROW = "@container documentation-design (max-width: 960px)";
const COMPACT = "@container documentation-design (max-width: 640px)";
const styles = stylex.create({
root: {
backgroundColor: semanticColors.bg,
color: semanticColors.fg,
containerName: "documentation-design",
containerType: "inline-size",
fontFamily: fonts.body,
minHeight: "100%",
width: "100%",
},
shell: {
marginBlock: 0,
marginInline: "auto",
maxWidth: "74rem",
paddingBlockEnd: spacing._14,
paddingBlockStart: spacing._6,
paddingInline: {
default: spacing._8,
[NARROW]: spacing._6,
[COMPACT]: spacing._4,
},
},
articleGrid: {
gap: {
default: spacing._10,
[NARROW]: spacing._6,
},
gridTemplateColumns: {
default: "minmax(0, 1fr) 14.5rem",
[NARROW]: "minmax(0, 1fr)",
},
},
tocRail: {
display: {
default: "flex",
[NARROW]: "none",
},
position: "sticky",
top: spacing._6,
},
railMetaCard: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
paddingBlock: spacing._3_5,
paddingInline: spacing._3_5,
},
railMetaList: {
marginBlock: 0,
paddingInlineStart: 0,
},
railMetaValue: {
marginInlineStart: 0,
},
mobileTocBox: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
display: {
default: "none",
[NARROW]: "flex",
},
paddingBlock: spacing._3_5,
paddingInline: spacing._4,
},
mobileTocLink: {
backgroundColor: {
default: semanticColors.bgMuted,
":hover": semanticColors.bgSubtle,
},
borderColor: semanticColors.borderSubtle,
borderRadius: radii.full,
borderStyle: "solid",
borderWidth: "1px",
color: semanticColors.fgMuted,
cursor: "pointer",
fontFamily: fonts.body,
fontSize: fontSizes.xs,
fontWeight: fontWeights.medium,
paddingBlock: spacing._1,
paddingInline: spacing._2_5,
textDecorationLine: "none",
transitionDuration: durations.fast,
transitionProperty: "background-color, color, border-color",
},
mobileTocLinkActive: {
backgroundColor: semanticColors.accentSubtle,
borderColor: semanticColors.accentBorder,
color: semanticColors.accentFg,
},
// Header & Editorial Typography
metaTimestamp: {
marginInlineStart: spacing._1,
},
heroTitle: {
color: semanticColors.fg,
marginBlock: 0,
},
leadParagraph: {
maxWidth: "46rem",
},
importStrip: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
paddingBlock: spacing._2_5,
paddingInlineEnd: spacing._2_5,
paddingInlineStart: spacing._3_5,
},
importCodeText: {
overflowX: "auto",
whiteSpace: "nowrap",
},
// Article Sections
scrollAnchor: {
scrollMarginTop: spacing._6,
},
subSectionHeading: {
color: semanticColors.fg,
marginBlockEnd: 0,
marginBlockStart: spacing._2,
scrollMarginTop: spacing._6,
},
sectionHeading: {
color: semanticColors.fg,
marginBlock: 0,
scrollMarginTop: spacing._6,
},
prose: {
lineHeight: lineHeights.lg,
maxWidth: "44rem",
},
leadingMd: {
lineHeight: lineHeights.md,
},
// Playground Card
playgroundCard: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderStyle: "solid",
borderWidth: "1px",
overflowX: "hidden",
overflowY: "hidden",
},
specimenBar: {
borderBottomColor: semanticColors.borderSubtle,
borderBottomStyle: "solid",
borderBottomWidth: "1px",
paddingBlock: spacing._2_5,
paddingInline: spacing._4,
},
stageCanvas: {
backgroundColor: semanticColors.bgMuted,
backgroundImage: `radial-gradient(${semanticColors.border} 1px, transparent 1px)`,
backgroundSize: "16px 16px",
minHeight: "13.5rem",
paddingBlock: spacing._8,
paddingInline: spacing._6,
position: "relative",
},
stageCanvasCompact: {
minHeight: "10.5rem",
paddingBlock: spacing._6,
},
splitGroupWrap: {
alignItems: "center",
display: "inline-flex",
flexDirection: "column",
gap: spacing._2,
position: "relative",
},
splitGroupRow: {
alignItems: "stretch",
display: "inline-flex",
gap: "1px",
},
splitPrimaryBtn: {
borderBottomLeftRadius: semanticRadii.control,
borderBottomRightRadius: 0,
borderRadius: null,
borderTopLeftRadius: semanticRadii.control,
borderTopRightRadius: 0,
},
splitTriggerBtn: {
borderBottomLeftRadius: 0,
borderBottomRightRadius: semanticRadii.control,
borderRadius: null,
borderTopLeftRadius: 0,
borderTopRightRadius: semanticRadii.control,
},
splitMenuPopover: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
boxShadow: semanticShadows.md,
minWidth: "15rem",
paddingBlock: spacing._1_5,
paddingInline: spacing._1_5,
},
splitMenuOption: {
alignItems: "center",
appearance: "none",
backgroundColor: {
default: "transparent",
":hover": semanticColors.interactionHover,
},
borderRadius: semanticRadii.control,
borderStyle: "none",
borderWidth: 0,
color: semanticColors.fg,
cursor: "pointer",
display: "flex",
fontFamily: fonts.body,
fontSize: fontSizes.xs,
gap: spacing._3,
justifyContent: "space-between",
paddingBlock: spacing._1_5,
paddingInline: spacing._2_5,
textAlign: "start",
width: "100%",
},
// Controls Matrix inside Playground
controlsPanel: {
backgroundColor: semanticColors.bgPanel,
borderTopColor: semanticColors.borderSubtle,
borderTopStyle: "solid",
borderTopWidth: "1px",
paddingBlock: spacing._4,
paddingInline: spacing._4,
},
controlsGrid: {
gridTemplateColumns: {
default: "repeat(2, minmax(0, 1fr))",
[COMPACT]: "minmax(0, 1fr)",
},
},
controlGroupWide: {
gridColumn: {
default: "1 / -1",
[COMPACT]: "auto",
},
},
controlLabel: {
letterSpacing: "0.02em",
},
segmentScrollWrap: {
maxWidth: "100%",
overflowX: "auto",
paddingBottom: spacing._0_5,
},
switchRow: {
paddingTop: spacing._1,
},
// CodeBlock styling
codeBlockSection: {
borderTopColor: semanticColors.borderSubtle,
borderTopStyle: "solid",
borderTopWidth: "1px",
paddingBlock: spacing._3_5,
paddingInline: spacing._4,
},
codeBlockRoot: {
borderColor: semanticColors.border,
borderStyle: "solid",
borderWidth: "1px",
},
codeBlockContent: {
backgroundColor: semanticColors.bgMuted,
borderBottomLeftRadius: semanticRadii.panelSm,
borderBottomRightRadius: semanticRadii.panelSm,
color: semanticColors.fg,
},
// Specimen Tabs Footer
specimenTabsFooter: {
backgroundColor: semanticColors.bgPanel,
borderTopColor: semanticColors.borderSubtle,
borderTopStyle: "solid",
borderTopWidth: "1px",
paddingBlockEnd: spacing._3_5,
paddingBlockStart: spacing._2,
paddingInline: spacing._4,
},
specimenTabList: {
borderBottomColor: semanticColors.borderSubtle,
borderBottomStyle: "solid",
borderBottomWidth: "1px",
},
specimenTabPanel: {
paddingBlockEnd: spacing._1,
paddingBlockStart: spacing._3_5,
paddingInline: 0,
},
// Do / Don't Paired Cards
doDontPair: {
gridTemplateColumns: {
default: "repeat(2, minmax(0, 1fr))",
[COMPACT]: "minmax(0, 1fr)",
},
},
doDontCard: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
overflowX: "hidden",
overflowY: "hidden",
},
doAccentBar: {
backgroundColor: semanticColors.successSolid,
height: "3px",
width: "100%",
},
dontAccentBar: {
backgroundColor: semanticColors.statusError,
height: "3px",
width: "100%",
},
doDontSpecimen: {
backgroundColor: semanticColors.bgMuted,
borderBottomColor: semanticColors.borderSubtle,
borderBottomStyle: "solid",
borderBottomWidth: "1px",
minHeight: "6.75rem",
paddingBlock: spacing._5,
paddingInline: spacing._4,
},
doDontBody: {
paddingBlock: spacing._3_5,
paddingInline: spacing._4,
},
// Props & Keyboard Tables
tableFrame: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
overflowX: "auto",
width: "100%",
},
tableHeadBg: {
backgroundColor: semanticColors.bgMuted,
},
tableHeadCell: {
borderBottomColor: semanticColors.border,
borderBottomStyle: "solid",
borderBottomWidth: "1px",
color: semanticColors.fgMuted,
fontSize: fontSizes.xs,
fontWeight: fontWeights.semibold,
paddingBlock: spacing._2_5,
paddingInline: spacing._3_5,
whiteSpace: "nowrap",
},
tableBodyCell: {
borderBottomColor: semanticColors.borderSubtle,
borderBottomStyle: "solid",
borderBottomWidth: "1px",
paddingBlock: spacing._3,
paddingInline: spacing._3_5,
verticalAlign: "top",
},
propNameStack: {
alignItems: "center",
display: "inline-flex",
flexWrap: "wrap",
gap: spacing._1_5,
},
propTypeText: {
lineHeight: lineHeights.sm,
whiteSpace: "pre-wrap",
wordBreak: "break-word",
},
propDescText: {
lineHeight: lineHeights.md,
minWidth: "14rem",
},
kbdCombo: {
alignItems: "center",
display: "inline-flex",
flexWrap: "wrap",
gap: spacing._1,
whiteSpace: "nowrap",
},
// ARIA Checklist Grid
ariaGrid: {
gridTemplateColumns: {
default: "repeat(2, minmax(0, 1fr))",
[COMPACT]: "minmax(0, 1fr)",
},
},
ariaItemCard: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
paddingBlock: spacing._3_5,
paddingInline: spacing._4,
},
// Recipes Card
recipesCard: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderStyle: "solid",
borderWidth: "1px",
overflowX: "hidden",
overflowY: "hidden",
paddingBlockEnd: spacing._4,
paddingBlockStart: spacing._2,
paddingInline: spacing._4,
},
// Footer — Feedback & Adjacent Articles
footerSection: {
paddingTop: spacing._2,
},
feedbackBar: {
backgroundColor: semanticColors.bgPanel,
borderColor: semanticColors.border,
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
paddingBlock: spacing._4,
paddingInline: spacing._5,
},
adjacentGrid: {
gridTemplateColumns: {
default: "repeat(2, minmax(0, 1fr))",
[COMPACT]: "minmax(0, 1fr)",
},
},
adjacentCardBtn: {
appearance: "none",
backgroundColor: {
default: semanticColors.bgPanel,
":hover": semanticColors.bgSubtle,
},
borderColor: {
default: semanticColors.border,
":hover": semanticColors.borderEmphasized,
},
borderRadius: semanticRadii.panel,
borderStyle: "solid",
borderWidth: "1px",
color: semanticColors.fg,
cursor: "pointer",
display: "flex",
flexDirection: "column",
fontFamily: fonts.body,
gap: spacing._1,
outlineColor: {
default: null,
":focus-visible": semanticColors.accentFocusRing,
},
outlineOffset: {
default: null,
":focus-visible": "2px",
},
outlineStyle: {
default: "none",
":focus-visible": "solid",
},
outlineWidth: {
default: null,
":focus-visible": "2px",
},
paddingBlock: spacing._4,
paddingInline: spacing._4,
textAlign: "start",
transitionDuration: durations.fast,
transitionProperty: "background-color, border-color",
width: "100%",
},
adjacentCardEnd: {
alignItems: "flex-end",
textAlign: "end",
},
adjacentDirection: {
alignItems: "center",
color: semanticColors.fgMuted,
display: "inline-flex",
fontSize: fontSizes.xs,
gap: spacing._1_5,
},
collapsedSpinnerBtn: {
minWidth: sizes._9,
paddingInline: spacing._2,
},
wordyBadBtn: {
maxWidth: "15rem",
overflowX: "hidden",
textOverflow: "ellipsis",
},
});
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
function paletteForTone(tone: PlaygroundTone) {
if (tone === "accent") return accentPalette;
if (tone === "destructive") return redPalette;
return undefined;
}
function buildPlaygroundSnippet({
variant,
size,
tone,
disabled,
loading,
leadingIcon,
splitTrigger,
}: {
variant: PlaygroundVariant;
size: PlaygroundSize;
tone: PlaygroundTone;
disabled: boolean;
loading: boolean;
leadingIcon: boolean;
splitTrigger: boolean;
}): string {
const props: string[] = [];
if (variant !== "surface") props.push(`variant="${variant}"`);
if (size !== "md") props.push(`size="${size}"`);
if (tone !== "neutral") props.push(`tone="${tone}"`);
if (leadingIcon && !loading) props.push("leadingIcon={<RocketLaunchIcon />}");
if (loading) {
props.push("loading");
props.push('loadingText="Deploying…"');
}
if (disabled) props.push("disabled");
const label = tone === "destructive" ? "Revoke deployment" : "Deploy release";
if (splitTrigger) {
const groupAttrs = [
variant !== "surface" ? `variant="${variant}"` : null,
size !== "md" ? `size="${size}"` : null,
tone !== "neutral" ? `tone="${tone}"` : null,
disabled ? "disabled" : null,
].filter(Boolean);
const groupPropsStr = groupAttrs.length > 0 ? ` ${groupAttrs.join(" ")}` : "";
const primaryExtras = [
leadingIcon && !loading ? "leadingIcon={<RocketLaunchIcon />}" : null,
loading ? 'loading loadingText="Deploying…"' : null,
].filter(Boolean);
const primaryPropsStr = primaryExtras.length > 0 ? ` ${primaryExtras.join(" ")}` : "";
return `<SplitTriggerGroup${groupPropsStr}>
<ActionButton${primaryPropsStr} onPress={handleDeploy}>
${label}
</ActionButton>
<ActionButton
aria-label="More deployment targets"
aria-haspopup="menu"
onPress={openTargetMenu}
/>
</SplitTriggerGroup>`;
}
if (props.length === 0) {
return `<ActionButton onPress={handleDeploy}>${label}</ActionButton>`;
}
return `<ActionButton\n ${props.join("\n ")}\n onPress={handleDeploy}\n>\n ${label}\n</ActionButton>`;
}
// ---------------------------------------------------------------------------
// Component
// ---------------------------------------------------------------------------
/**
* DocumentationDesign — editorial design-system component reference article
* pairing live interactive specimens and a configurable playground with
* generated code, paired Do / Don't visual guidance cards, a filterable API
* props table, copyable usage recipes, keyboard & ARIA contracts, and a
* sticky scroll-spy Table of Contents that collapses on narrow widths.
*/
export function DocumentationDesign({
componentName = "Action Button & Split Trigger",
systemName = "Solstice Design System",
version = "v3.4.2",
packageName = "@solstice-ui/action-button",
updatedLabel = "Updated Nov 28, 2026",
propSpecs = DEFAULT_PROP_SPECS,
keyboardRows = DEFAULT_KEYBOARD_ROWS,
onNavigateArticle,
onFeedback,
palette,
style,
}: DocumentationDesignProps) {
const uid = useId().replace(/:/g, "");
const queue = useMemo(() => Toast.createToaster(), []);
// Playground state
const [pgVariant, setPgVariant] = useState<PlaygroundVariant>("solid");
const [pgSize, setPgSize] = useState<PlaygroundSize>("md");
const [pgTone, setPgTone] = useState<PlaygroundTone>("accent");
const [pgDisabled, setPgDisabled] = useState(false);
const [pgLoading, setPgLoading] = useState(false);
const [pgLeadingIcon, setPgLeadingIcon] = useState(true);
const [pgSplitTrigger, setPgSplitTrigger] = useState(false);
const [pgMenuOpen, setPgMenuOpen] = useState(false);
// Specimen & section UI state
const [splitExampleMenuOpen, setSplitExampleMenuOpen] = useState(false);
const [propCategory, setPropCategory] = useState<PropCategory>("all");
const [copiedKey, setCopiedKey] = useState<string | null>(null);
const [feedbackChoice, setFeedbackChoice] = useState<"yes" | "no" | null>(null);
const sectionIds = useMemo(
() =>
SECTION_DEFS.map((section) => ({
...section,
id: `${uid}-${section.slug}`,
})),
[uid],
);
const sectionIdBySlug = useMemo(() => {
const map = new Map<string, string>();
for (const s of sectionIds) {
map.set(s.slug, s.id);
}
return map;
}, [sectionIds]);
const tocItems: TocItemData[] = useMemo(
() => sectionIds.map((s) => ({ value: s.id, depth: s.depth })),
[sectionIds],
);
const [activeSectionId, setActiveSectionId] = useState<string>(() => sectionIds[0]?.id ?? "");
const playgroundCode = useMemo(
() =>
buildPlaygroundSnippet({
variant: pgVariant,
size: pgSize,
tone: pgTone,
disabled: pgDisabled,
loading: pgLoading,
leadingIcon: pgLeadingIcon,
splitTrigger: pgSplitTrigger,
}),
[pgVariant, pgSize, pgTone, pgDisabled, pgLoading, pgLeadingIcon, pgSplitTrigger],
);
const filteredProps = useMemo(
() =>
propCategory === "all"
? propSpecs
: propSpecs.filter((prop) => prop.category === propCategory),
[propSpecs, propCategory],
);
const copySnippet = useCallback(
(text: string, label: string, key: string) => {
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
void navigator.clipboard.writeText(text).catch(() => {});
}
setCopiedKey(key);
window.setTimeout(() => {
setCopiedKey((current) => (current === key ? null : current));
}, 1600);
queue.success(`Copied ${label}`, {
description: text.split("\n")[0],
});
},
[queue],
);
const handleResetPlayground = useCallback(() => {
setPgVariant("solid");
setPgSize("md");
setPgTone("accent");
setPgDisabled(false);
setPgLoading(false);
setPgLeadingIcon(true);
setPgSplitTrigger(false);
setPgMenuOpen(false);
queue.info("Playground reset", {
description: "Restored default solid accent specimen.",
});
}, [queue]);
const handleJumpToSection = useCallback((id: string) => {
setActiveSectionId(id);
const el = document.getElementById(id);
el?.scrollIntoView({ behavior: "smooth", block: "start" });
}, []);
const handleCrumbClick = useCallback(
(event: React.MouseEvent<HTMLAnchorElement>, label: string, path: string) => {
event.preventDefault();
queue.info(`Navigated to ${label}`, {
description: `Demo route → ${path}`,
});
},
[queue],
);
const handleFeedback = useCallback(
(helpful: boolean) => {
setFeedbackChoice(helpful ? "yes" : "no");
onFeedback?.(helpful);
if (helpful) {
queue.success("Thanks for the feedback", {
description: "Recorded as helpful for Solstice v3.4 documentation.",
});
} else {
queue.info("Feedback received", {
description: "Our design-systems team reviews doc gaps every sprint.",
});
}
},
[onFeedback, queue],
);
const handleArticleNav = useCallback(
(article: AdjacentArticleLink) => {
onNavigateArticle?.(article);
queue.info(`Opening ${article.title}`, {
description: `${article.section} · /docs/components/${article.slug}`,
});
},
[onNavigateArticle, queue],
);
const pgPalette = paletteForTone(pgTone);
const pgButtonLabel = pgLoading
? "Deploying…"
: pgTone === "destructive"
? "Revoke deployment"
: "Deploy release";
const importStatement = `import { ActionButton } from "${packageName}";`;
return (
<div {...stylex.props(palette, styles.root, style)}>
<div {...stylex.props(styles.shell)}>
<Grid align="start" style={styles.articleGrid}>
{/* Main editorial reference column */}
<VStack render={<article />} gap="10">
{/* Article Header */}
<VStack render={<header />} gap="4">
<Breadcrumb.Root aria-label="Component documentation breadcrumb" size="sm">
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link
href="#solstice"
onClick={(e) => handleCrumbClick(e, systemName, "/docs")}
>
{systemName}
</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator aria-hidden="true">
<ChevronRightIcon />
</Breadcrumb.Separator>
<Breadcrumb.Item>
<Breadcrumb.Link
href="#components"
onClick={(e) => handleCrumbClick(e, "Components", "/docs/components")}
>
Components
</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator aria-hidden="true">
<ChevronRightIcon />
</Breadcrumb.Separator>
<Breadcrumb.Item>
<Breadcrumb.Link
href="#actions"
onClick={(e) => handleCrumbClick(e, "Actions", "/docs/components/actions")}
>
Actions
</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator aria-hidden="true">
<ChevronRightIcon />
</Breadcrumb.Separator>
<Breadcrumb.Item>
<Breadcrumb.CurrentLink aria-current="page">
{componentName}
</Breadcrumb.CurrentLink>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>
<HStack gap="2" wrap="wrap">
<Badge variant="subtle" size="sm" palette={emeraldPalette}>
Stable
</Badge>
<Badge variant="outline" size="sm">
{version}
</Badge>
<Badge variant="subtle" size="sm" palette={accentPalette}>
WCAG 2.2 AA
</Badge>
<Text render={<span />} variant="subtle" size="xs" style={styles.metaTimestamp}>
{updatedLabel}
</Text>
</HStack>
<Heading render={<h1 />} size="4xl" style={styles.heroTitle}>
{componentName}
</Heading>
<Text variant="muted" size="lg" style={styles.leadParagraph}>
Action buttons trigger immediate commands, form submissions, and asynchronous
deployments. Pair a primary trigger with an attached split menu when a surface
exposes secondary commit modes without competing for focal attention.
</Text>
{/* Quick import & utility bar */}
<HStack gap="2.5" justify="between" wrap="wrap" style={styles.importStrip}>
<Text render={<code />} variant="mono" size="xs" style={styles.importCodeText}>
{importStatement}
</Text>
<HStack gap="1.5" wrap="wrap">
<Button
variant="surface"
size="xs"
onClick={() => copySnippet(importStatement, "import statement", "hero-import")}
>
{copiedKey === "hero-import" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "hero-import" ? "Copied" : "Copy import"}
</Button>
<Button
variant="ghost"
size="xs"
onClick={() =>
queue.info("Solstice Token Inspector", {
description: "Uses semanticColors.accentSolid, semanticRadii.control, and sizes.controlMd.",
})
}
>
Tokens
</Button>
</HStack>
</HStack>
{/* Collapsed inline TOC for narrow container widths */}
<VStack
render={<nav aria-label="On this page" />}
gap="2.5"
style={styles.mobileTocBox}
>
<Text variant="overline">On this page</Text>
<HStack gap="1.5" wrap="wrap">
{sectionIds.map((section) => {
const isActive = activeSectionId === section.id;
return (
<button
key={section.id}
type="button"
onClick={() => handleJumpToSection(section.id)}
{...stylex.props(
styles.mobileTocLink,
isActive && styles.mobileTocLinkActive,
)}
>
{section.label}
</button>
);
})}
</HStack>
</VStack>
</VStack>
<Separator />
{/* Section 1: Interactive Playground */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("playground")} />}
gap="4"
style={styles.scrollAnchor}
>
<Heading
id={sectionIdBySlug.get("playground")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
Interactive playground
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
Test emphasis variants, density scales, loading transitions, and split-trigger
composition directly. The generated JSX below stays synchronized with every control.
</Text>
<Card.Root variant="outline" size="md" style={styles.playgroundCard}>
{/* Specimen toolbar */}
<HStack gap="2.5" justify="between" wrap="wrap" style={styles.specimenBar}>
<HStack gap="2" wrap="wrap">
<Text render={<span />} size="sm" weight="semibold">
Live specimen
</Text>
<Code variant="subtle" size="xs">
{pgVariant} · {pgSize} · {pgTone}
</Code>
</HStack>
<HStack gap="1.5">
<Button variant="ghost" size="xs" onClick={handleResetPlayground}>
<ResetIcon />
Reset
</Button>
<Button
variant="surface"
size="xs"
onClick={() => copySnippet(playgroundCode, "playground JSX", "pg-jsx")}
>
{copiedKey === "pg-jsx" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "pg-jsx" ? "Copied" : "Copy JSX"}
</Button>
</HStack>
</HStack>
{/* Interactive Preview Stage */}
<VStack align="center" justify="center" gap="4" style={styles.stageCanvas}>
{pgSplitTrigger ? (
<div {...stylex.props(styles.splitGroupWrap)}>
<div
role="group"
aria-label="Action button with split menu preview"
{...stylex.props(styles.splitGroupRow)}
>
<Button
variant={pgVariant}
size={pgSize}
palette={pgPalette}
disabled={pgDisabled || pgLoading}
aria-busy={pgLoading || undefined}
style={styles.splitPrimaryBtn}
onClick={() =>
queue.success("Primary action triggered", {
description: `Executed "${pgButtonLabel}" (${pgVariant}, ${pgSize}).`,
})
}
>
{pgLoading ? (
<Spinner size="xs" />
) : pgLeadingIcon ? (
<RocketLaunchIcon />
) : null}
{pgButtonLabel}
</Button>
<IconButton
variant={pgVariant}
size={pgSize}
palette={pgPalette}
disabled={pgDisabled || pgLoading}
aria-label="More deployment options"
aria-haspopup="menu"
aria-expanded={pgMenuOpen}
style={styles.splitTriggerBtn}
onClick={() => setPgMenuOpen((open) => !open)}
>
<ChevronDownIcon />
</IconButton>
</div>
{pgMenuOpen && !pgDisabled && !pgLoading ? (
<VStack
role="menu"
aria-label="Deployment targets"
gap="0.5"
style={styles.splitMenuPopover}
>
{SPLIT_MENU_OPTIONS.map((option) => (
<button
key={option.id}
type="button"
role="menuitem"
{...stylex.props(styles.splitMenuOption)}
onClick={() => {
setPgMenuOpen(false);
queue.info(option.label, {
description: option.hint,
});
}}
>
<Text render={<span />} size="xs" weight="medium">
{option.label}
</Text>
<Text render={<span />} variant="muted" size="2xs">
{option.hint}
</Text>
</button>
))}
</VStack>
) : null}
</div>
) : (
<Button
variant={pgVariant}
size={pgSize}
palette={pgPalette}
disabled={pgDisabled || pgLoading}
aria-busy={pgLoading || undefined}
onClick={() =>
queue.success("Action committed", {
description: `Triggered ${pgVariant} (${pgSize}) button in ${pgTone} tone.`,
})
}
>
{pgLoading ? (
<Spinner size="xs" />
) : pgLeadingIcon ? (
<RocketLaunchIcon />
) : null}
{pgButtonLabel}
</Button>
)}
<Text variant="subtle" size="xs" align="center">
{pgDisabled
? "Disabled state prevents pointer and keyboard activation."
: pgLoading
? "Pending state preserves width and announces aria-busy to assistive tech."
: pgSplitTrigger
? "Click the primary button to commit or the chevron trigger to preview secondary options."
: "Click the specimen button to verify interactive press feedback."}
</Text>
</VStack>
{/* Live Controls Matrix */}
<VStack gap="4" style={styles.controlsPanel}>
<Grid gap="4" style={styles.controlsGrid}>
<VStack gap="2" style={styles.controlGroupWide}>
<Text
render={<span />}
variant="muted"
size="xs"
weight="semibold"
style={styles.controlLabel}
>
Variant
</Text>
<div {...stylex.props(styles.segmentScrollWrap)}>
<SegmentGroup.Root
size="sm"
aria-label="Playground button variant"
value={pgVariant}
onValueChange={(next) => setPgVariant(next as PlaygroundVariant)}
>
<SegmentGroup.Item value="solid">Solid</SegmentGroup.Item>
<SegmentGroup.Item value="surface">Surface</SegmentGroup.Item>
<SegmentGroup.Item value="outline">Outline</SegmentGroup.Item>
<SegmentGroup.Item value="subtle">Subtle</SegmentGroup.Item>
<SegmentGroup.Item value="ghost">Ghost</SegmentGroup.Item>
</SegmentGroup.Root>
</div>
</VStack>
<VStack gap="2">
<Text
render={<span />}
variant="muted"
size="xs"
weight="semibold"
style={styles.controlLabel}
>
Size
</Text>
<div {...stylex.props(styles.segmentScrollWrap)}>
<SegmentGroup.Root
size="sm"
aria-label="Playground button size"
value={pgSize}
onValueChange={(next) => setPgSize(next as PlaygroundSize)}
>
<SegmentGroup.Item value="xs">XS</SegmentGroup.Item>
<SegmentGroup.Item value="sm">SM</SegmentGroup.Item>
<SegmentGroup.Item value="md">MD</SegmentGroup.Item>
<SegmentGroup.Item value="lg">LG</SegmentGroup.Item>
</SegmentGroup.Root>
</div>
</VStack>
<VStack gap="2">
<Text
render={<span />}
variant="muted"
size="xs"
weight="semibold"
style={styles.controlLabel}
>
Tone
</Text>
<div {...stylex.props(styles.segmentScrollWrap)}>
<SegmentGroup.Root
size="sm"
aria-label="Playground button tone"
value={pgTone}
onValueChange={(next) => setPgTone(next as PlaygroundTone)}
>
<SegmentGroup.Item value="accent">Accent</SegmentGroup.Item>
<SegmentGroup.Item value="neutral">Neutral</SegmentGroup.Item>
<SegmentGroup.Item value="destructive">Destructive</SegmentGroup.Item>
</SegmentGroup.Root>
</div>
</VStack>
</Grid>
<HStack gap="5" wrap="wrap" style={styles.switchRow}>
<Switch.Root size="sm" palette={accentPalette}>
<Switch.Control
checked={pgLeadingIcon}
onCheckedChange={(checked) => setPgLeadingIcon(checked === true)}
/>
<Switch.Label>Leading icon</Switch.Label>
</Switch.Root>
<Switch.Root size="sm" palette={accentPalette}>
<Switch.Control
checked={pgSplitTrigger}
onCheckedChange={(checked) => {
const enabled = checked === true;
setPgSplitTrigger(enabled);
if (!enabled) setPgMenuOpen(false);
}}
/>
<Switch.Label>Split trigger</Switch.Label>
</Switch.Root>
<Switch.Root size="sm" palette={accentPalette}>
<Switch.Control
checked={pgLoading}
onCheckedChange={(checked) => setPgLoading(checked === true)}
/>
<Switch.Label>Loading</Switch.Label>
</Switch.Root>
<Switch.Root size="sm" palette={accentPalette}>
<Switch.Control
checked={pgDisabled}
onCheckedChange={(checked) => setPgDisabled(checked === true)}
/>
<Switch.Label>Disabled</Switch.Label>
</Switch.Root>
</HStack>
</VStack>
{/* Generated CodeBlock */}
<div {...stylex.props(styles.codeBlockSection)}>
<CodeBlock.Root size="sm" style={styles.codeBlockRoot}>
<CodeBlock.Header>
<CodeBlock.Title>Generated TSX</CodeBlock.Title>
<CodeBlock.Control>
<Button
variant="ghost"
size="2xs"
onClick={() => copySnippet(playgroundCode, "generated TSX", "pg-code")}
>
{copiedKey === "pg-code" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "pg-code" ? "Copied" : "Copy"}
</Button>
</CodeBlock.Control>
</CodeBlock.Header>
<CodeBlock.Content style={styles.codeBlockContent}>
<CodeBlock.Code>
<CodeBlock.CodeText>{playgroundCode}</CodeBlock.CodeText>
</CodeBlock.Code>
</CodeBlock.Content>
</CodeBlock.Root>
</div>
</Card.Root>
</VStack>
{/* Section 2: Emphasis & Variants */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("variants")} />}
gap="4"
style={styles.scrollAnchor}
>
<Heading
id={sectionIdBySlug.get("variants")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
Emphasis & variants
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
Solstice structures action hierarchy across five surface weights. Use a single solid
accent button to anchor the primary path, pair adjacent secondary tasks with surface
or outline treatments, and step repetitive toolbar commands down to ghost.
</Text>
{/* Specimen 1: Emphasis scale */}
<Card.Root variant="outline" size="md" style={styles.playgroundCard}>
<HStack gap="2.5" justify="between" wrap="wrap" style={styles.specimenBar}>
<Text render={<span />} size="sm" weight="semibold">
Emphasis scale
</Text>
<Button
variant="ghost"
size="xs"
onClick={() => copySnippet(EMPHASIS_SNIPPET, "emphasis snippet", "emphasis-sn")}
>
{copiedKey === "emphasis-sn" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "emphasis-sn" ? "Copied" : "Copy"}
</Button>
</HStack>
<VStack
align="center"
justify="center"
gap="4"
style={[styles.stageCanvas, styles.stageCanvasCompact]}
>
<HStack gap="3" justify="center" wrap="wrap">
<Button variant="solid" size="md" palette={accentPalette}>
Publish
</Button>
<Button variant="surface" size="md">
Save draft
</Button>
<Button variant="outline" size="md">
Preview
</Button>
<Button variant="subtle" size="md" palette={accentPalette}>
Duplicate
</Button>
<Button variant="ghost" size="md">
Cancel
</Button>
<Button variant="solid" size="md" palette={redPalette}>
<TrashIcon />
Archive
</Button>
</HStack>
</VStack>
<div {...stylex.props(styles.specimenTabsFooter)}>
<Tabs.Root defaultValue="notes" variant="line" size="sm" palette={accentPalette}>
<Tabs.List style={styles.specimenTabList}>
<Tabs.Tab value="notes">Guidance</Tabs.Tab>
<Tabs.Tab value="code">TSX</Tabs.Tab>
<Tabs.Tab value="tokens">Tokens</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="notes" style={styles.specimenTabPanel}>
<Text variant="muted" size="md" style={styles.prose}>
Keep destructive actions out of the primary accent channel. When an
irreversible command lives inside a toolbar, use <Code size="xs">outline</Code>{" "}
with a destructive tone and escalate to <Code size="xs">solid</Code> only
inside the final confirmation dialog.
</Text>
</Tabs.Panel>
<Tabs.Panel value="code" style={styles.specimenTabPanel}>
<CodeBlock.Root size="sm" style={styles.codeBlockRoot}>
<CodeBlock.Content style={styles.codeBlockContent}>
<CodeBlock.Code>
<CodeBlock.CodeText>{EMPHASIS_SNIPPET}</CodeBlock.CodeText>
</CodeBlock.Code>
</CodeBlock.Content>
</CodeBlock.Root>
</Tabs.Panel>
<Tabs.Panel value="tokens" style={styles.specimenTabPanel}>
<HStack gap="2" wrap="wrap">
<Code variant="subtle" size="sm">
semanticColors.accentSolid
</Code>
<Code variant="subtle" size="sm">
semanticColors.bg
</Code>
<Code variant="subtle" size="sm">
semanticRadii.control
</Code>
<Code variant="subtle" size="sm">
sizes.controlMd
</Code>
</HStack>
</Tabs.Panel>
</Tabs.Root>
</div>
</Card.Root>
<Alert.Root role="note" status="info" variant="subtle" size="md" palette={bluePalette}>
<Alert.Indicator>
<InfoCircleIcon />
</Alert.Indicator>
<Alert.Content>
<Alert.Title>Single primary commitment rule</Alert.Title>
<Alert.Description>
Limit every view, panel, or modal footer to one solid accent button. When two
neighboring commands carry equal priority, present both using the surface
variant so neither falsely dominates.
</Alert.Description>
</Alert.Content>
</Alert.Root>
{/* Sub-section: Split trigger pattern */}
<Heading
id={sectionIdBySlug.get("split-trigger")}
render={<h3 />}
size="lg"
style={styles.subSectionHeading}
>
Split trigger pattern
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
When 80% of users invoke one default command (such as publishing immediately) while
power users occasionally need alternate schedules or targets, couple a primary
button with an attached menu chevron instead of crowding the toolbar.
</Text>
<Card.Root variant="outline" size="md" style={styles.playgroundCard}>
<HStack gap="2.5" justify="between" wrap="wrap" style={styles.specimenBar}>
<Text render={<span />} size="sm" weight="semibold">
Release toolbar composition
</Text>
<Button
variant="ghost"
size="xs"
onClick={() => copySnippet(SPLIT_SNIPPET, "split trigger JSX", "split-sn")}
>
{copiedKey === "split-sn" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "split-sn" ? "Copied" : "Copy"}
</Button>
</HStack>
<VStack
align="center"
justify="center"
gap="4"
style={[styles.stageCanvas, styles.stageCanvasCompact]}
>
<HStack gap="3" justify="center" wrap="wrap">
<Button
variant="ghost"
size="md"
onClick={() =>
queue.info("Preview opened", {
description: "Staging diff preview for v3.4.2.",
})
}
>
Preview diff
</Button>
<Button
variant="surface"
size="md"
onClick={() =>
queue.info("Draft saved", {
description: "Snapshot persisted to release branch.",
})
}
>
Save draft
</Button>
<div {...stylex.props(styles.splitGroupWrap)}>
<div
role="group"
aria-label="Publish release split trigger"
{...stylex.props(styles.splitGroupRow)}
>
<Button
variant="solid"
size="md"
palette={accentPalette}
style={styles.splitPrimaryBtn}
onClick={() =>
queue.success("Published v3.4.2", {
description: "Rolled out to production edge regions.",
})
}
>
<RocketLaunchIcon />
Publish v3.4
</Button>
<IconButton
variant="solid"
size="md"
palette={accentPalette}
aria-label="Choose publish schedule"
aria-haspopup="menu"
aria-expanded={splitExampleMenuOpen}
style={styles.splitTriggerBtn}
onClick={() => setSplitExampleMenuOpen((prev) => !prev)}
>
<ChevronDownIcon />
</IconButton>
</div>
{splitExampleMenuOpen ? (
<VStack
role="menu"
aria-label="Publish schedule options"
gap="0.5"
style={styles.splitMenuPopover}
>
{SPLIT_MENU_OPTIONS.map((option) => (
<button
key={option.id}
type="button"
role="menuitem"
{...stylex.props(styles.splitMenuOption)}
onClick={() => {
setSplitExampleMenuOpen(false);
queue.info(option.label, { description: option.hint });
}}
>
<Text render={<span />} size="xs" weight="medium">
{option.label}
</Text>
<Text render={<span />} variant="muted" size="2xs">
{option.hint}
</Text>
</button>
))}
</VStack>
) : null}
</div>
</HStack>
</VStack>
<div {...stylex.props(styles.specimenTabsFooter)}>
<Tabs.Root defaultValue="notes" variant="line" size="sm" palette={accentPalette}>
<Tabs.List style={styles.specimenTabList}>
<Tabs.Tab value="notes">Guidance</Tabs.Tab>
<Tabs.Tab value="code">TSX</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="notes" style={styles.specimenTabPanel}>
<Text variant="muted" size="md" style={styles.prose}>
Keep both halves in the same visual weight and tone so they read as one
compound control, while giving each half its own independent tab stop and
accessible name.
</Text>
</Tabs.Panel>
<Tabs.Panel value="code" style={styles.specimenTabPanel}>
<CodeBlock.Root size="sm" style={styles.codeBlockRoot}>
<CodeBlock.Content style={styles.codeBlockContent}>
<CodeBlock.Code>
<CodeBlock.CodeText>{SPLIT_SNIPPET}</CodeBlock.CodeText>
</CodeBlock.Code>
</CodeBlock.Content>
</CodeBlock.Root>
</Tabs.Panel>
</Tabs.Root>
</div>
</Card.Root>
</VStack>
{/* Section 3: Paired Do / Don't Visual Guidance */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("guidelines")} />}
gap="4"
style={styles.scrollAnchor}
>
<Heading
id={sectionIdBySlug.get("guidelines")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
Do & Don't guidelines
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
Compare recommended patterns against common failure modes across action hierarchy,
label clarity, and asynchronous feedback.
</Text>
<VStack gap="5">
{/* Pair 1: Action hierarchy */}
<Grid gap="4" style={styles.doDontPair}>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.doAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="ghost" size="sm">
Preview
</Button>
<Button variant="surface" size="sm">
Discard
</Button>
<Button variant="solid" size="sm" palette={accentPalette}>
Save changes
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={emeraldPalette}>
<CheckIcon />
Do
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Establish one clear focal action
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Pair one solid primary commitment with muted surface and ghost siblings so
readers immediately recognize the intended path.
</Text>
</VStack>
</VStack>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.dontAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="solid" size="sm" palette={accentPalette}>
Preview
</Button>
<Button variant="solid" size="sm" palette={accentPalette}>
Share
</Button>
<Button variant="solid" size="sm" palette={accentPalette}>
Save changes
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={redPalette}>
<XMarkIcon />
Don't
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Stack competing solid buttons
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Placing multiple solid accent buttons side by side flattens hierarchy, adds
visual noise, and slows down scanning.
</Text>
</VStack>
</VStack>
</Grid>
{/* Pair 2: Label clarity & destructive intent */}
<Grid gap="4" style={styles.doDontPair}>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.doAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="surface" size="sm">
Cancel
</Button>
<Button variant="solid" size="sm" palette={redPalette}>
Archive project
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={emeraldPalette}>
<CheckIcon />
Do
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Lead with concise verb + noun
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Name the exact object being modified (“Archive project”) so users can
confirm destructive outcomes without re-reading dialog copy.
</Text>
</VStack>
</VStack>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.dontAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="surface" size="sm">
OK
</Button>
<Button
variant="solid"
size="sm"
palette={redPalette}
style={styles.wordyBadBtn}
>
Yes, permanently click here to proceed
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={redPalette}>
<XMarkIcon />
Don't
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Use vague or sentence-length labels
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Generic “OK” labels obscure consequences, while full sentences truncate
awkwardly in localized and compact layouts.
</Text>
</VStack>
</VStack>
</Grid>
{/* Pair 3: Async loading feedback */}
<Grid gap="4" style={styles.doDontPair}>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.doAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="surface" size="sm" disabled>
Cancel
</Button>
<Button
variant="solid"
size="sm"
palette={accentPalette}
disabled
aria-busy="true"
>
<Spinner size="xs" />
Deploying…
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={emeraldPalette}>
<CheckIcon />
Do
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Keep width & status text stable
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Pair an inline spinner with present-participle copy so layout geometry stays
steady and screen readers announce progress.
</Text>
</VStack>
</VStack>
<VStack gap="0" style={styles.doDontCard}>
<div {...stylex.props(styles.dontAccentBar)} />
<HStack gap="2.5" justify="center" wrap="wrap" style={styles.doDontSpecimen}>
<Button variant="surface" size="sm">
Cancel
</Button>
<Button
variant="solid"
size="sm"
palette={accentPalette}
aria-label="Loading"
style={styles.collapsedSpinnerBtn}
>
<Spinner size="xs" />
</Button>
</HStack>
<VStack gap="2" style={styles.doDontBody}>
<HStack gap="2">
<Badge variant="subtle" size="sm" palette={redPalette}>
<XMarkIcon />
Don't
</Badge>
<Text render={<h3 />} size="sm" weight="semibold">
Collapse the label into a bare spinner
</Text>
</HStack>
<Text variant="muted" size="xs" style={styles.leadingMd}>
Replacing the text with an unguarded spinner causes horizontal toolbar jump
and allows accidental double submissions.
</Text>
</VStack>
</VStack>
</Grid>
</VStack>
</VStack>
{/* Section 4: API & Props Table */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("api-props")} />}
gap="4"
style={styles.scrollAnchor}
>
<HStack gap="3" justify="between" wrap="wrap">
<Heading
id={sectionIdBySlug.get("api-props")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
API & props
</Heading>
<div {...stylex.props(styles.segmentScrollWrap)}>
<SegmentGroup.Root
size="xs"
aria-label="Filter API props by category"
value={propCategory}
onValueChange={(next) => setPropCategory(next as PropCategory)}
>
<SegmentGroup.Item value="all">All ({propSpecs.length})</SegmentGroup.Item>
<SegmentGroup.Item value="visual">Visual</SegmentGroup.Item>
<SegmentGroup.Item value="behavior">Behavior</SegmentGroup.Item>
<SegmentGroup.Item value="a11y">A11y</SegmentGroup.Item>
</SegmentGroup.Root>
</div>
</HStack>
<Text variant="muted" size="md" style={styles.prose}>
All native <Code size="xs">HTMLButtonElement</Code> attributes pass through cleanly.
Style overrides accept compiled StyleX objects via <Code size="xs">style</Code> and
semantic color themes via <Code size="xs">palette</Code>.
</Text>
<div {...stylex.props(styles.tableFrame)}>
<Table.Root variant="line" size="md">
<Table.Header style={styles.tableHeadBg}>
<Table.Row>
<Table.ColumnHeader style={styles.tableHeadCell}>Prop</Table.ColumnHeader>
<Table.ColumnHeader style={styles.tableHeadCell}>Type</Table.ColumnHeader>
<Table.ColumnHeader style={styles.tableHeadCell}>Default</Table.ColumnHeader>
<Table.ColumnHeader style={styles.tableHeadCell}>
Description
</Table.ColumnHeader>
</Table.Row>
</Table.Header>
<Table.Body>
{filteredProps.map((prop) => (
<Table.Row key={prop.name}>
<Table.Cell style={styles.tableBodyCell}>
<div {...stylex.props(styles.propNameStack)}>
<Code variant="subtle" size="sm" palette={accentPalette}>
{prop.name}
</Code>
{prop.required ? (
<Badge variant="subtle" size="xs" palette={redPalette}>
Required
</Badge>
) : null}
</div>
</Table.Cell>
<Table.Cell style={styles.tableBodyCell}>
<Text
render={<span />}
variant="mono"
tone="muted"
size="xs"
style={styles.propTypeText}
>
{prop.type}
</Text>
</Table.Cell>
<Table.Cell style={styles.tableBodyCell}>
<Code variant="outline" size="xs">
{prop.defaultValue}
</Code>
</Table.Cell>
<Table.Cell style={styles.tableBodyCell}>
<Text variant="muted" size="xs" style={styles.propDescText}>
{prop.description}
</Text>
</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table.Root>
</div>
</VStack>
{/* Section 5: Copyable Usage Recipes */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("recipes")} />}
gap="4"
style={styles.scrollAnchor}
>
<Heading
id={sectionIdBySlug.get("recipes")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
Usage recipes
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
Drop-in implementation snippets covering async Promise commits, split trigger
menus, anchor element composition, and package installation.
</Text>
<Card.Root variant="outline" size="md" style={styles.recipesCard}>
<Tabs.Root defaultValue="async" variant="line" size="sm" palette={accentPalette}>
<Tabs.List style={styles.specimenTabList}>
<Tabs.Tab value="async">Async commit</Tabs.Tab>
<Tabs.Tab value="split">Split trigger</Tabs.Tab>
<Tabs.Tab value="compose">Link composition</Tabs.Tab>
<Tabs.Tab value="install">Install</Tabs.Tab>
</Tabs.List>
{(
Object.entries(RECIPE_SNIPPETS) as Array<
[keyof typeof RECIPE_SNIPPETS, (typeof RECIPE_SNIPPETS)[keyof typeof RECIPE_SNIPPETS]]
>
).map(([key, recipe]) => (
<Tabs.Panel key={key} value={key} style={styles.specimenTabPanel}>
<CodeBlock.Root size="sm" style={styles.codeBlockRoot}>
<CodeBlock.Header>
<CodeBlock.Title>{recipe.filename}</CodeBlock.Title>
<CodeBlock.Control>
<Button
variant="ghost"
size="2xs"
onClick={() =>
copySnippet(recipe.code, recipe.filename, `recipe-${key}`)
}
>
{copiedKey === `recipe-${key}` ? <CheckIcon /> : <CopyIcon />}
{copiedKey === `recipe-${key}` ? "Copied" : "Copy"}
</Button>
</CodeBlock.Control>
</CodeBlock.Header>
<CodeBlock.Content style={styles.codeBlockContent}>
<CodeBlock.Code>
<CodeBlock.CodeText>{recipe.code}</CodeBlock.CodeText>
</CodeBlock.Code>
</CodeBlock.Content>
</CodeBlock.Root>
</Tabs.Panel>
))}
</Tabs.Root>
</Card.Root>
</VStack>
{/* Section 6: Keyboard & Accessibility Contract */}
<VStack
render={<section aria-labelledby={sectionIdBySlug.get("accessibility")} />}
gap="4"
style={styles.scrollAnchor}
>
<Heading
id={sectionIdBySlug.get("accessibility")}
render={<h2 />}
size="2xl"
style={styles.sectionHeading}
>
Keyboard & ARIA contract
</Heading>
<Text variant="muted" size="md" style={styles.prose}>
Action Button conforms to the WAI-ARIA Button and Menu Button patterns with a
high-contrast <Code size="xs">2px</Code> offset focus ring visible across both light
and dark surfaces.
</Text>
<Alert.Root
role="note"
status="warning"
variant="subtle"
size="md"
palette={amberPalette}
>
<Alert.Indicator>
<WarningTriangleIcon />
</Alert.Indicator>
<Alert.Content>
<Alert.Title>Preserve focus during asynchronous loading</Alert.Title>
<Alert.Description>
Native <Code size="xs">disabled</Code> removes a button from the tab sequence
and can drop screen-reader focus to the document body. During short network
requests, prefer <Code size="xs">aria-disabled="true"</Code> with{" "}
<Code size="xs">aria-busy="true"</Code>.
</Alert.Description>
</Alert.Content>
</Alert.Root>
<div {...stylex.props(styles.tableFrame)}>
<Table.Root variant="line" size="sm">
<Table.Header style={styles.tableHeadBg}>
<Table.Row>
<Table.ColumnHeader style={styles.tableHeadCell}>Key</Table.ColumnHeader>
<Table.ColumnHeader style={styles.tableHeadCell}>
Expected behavior
</Table.ColumnHeader>
<Table.ColumnHeader style={styles.tableHeadCell}>Scope</Table.ColumnHeader>
</Table.Row>
</Table.Header>
<Table.Body>
{keyboardRows.map((row) => (
<Table.Row key={row.keys.join("+")}>
<Table.Cell style={styles.tableBodyCell}>
<span {...stylex.props(styles.kbdCombo)}>
{row.keys.map((keyLabel, idx) => (
<span key={keyLabel} {...stylex.props(styles.kbdCombo)}>
{idx > 0 ? (
<Text render={<span />} variant="subtle" size="xs">
+
</Text>
) : null}
<Kbd variant="raised" size="sm">
{keyLabel}
</Kbd>
</span>
))}
</span>
</Table.Cell>
<Table.Cell style={styles.tableBodyCell}>
<Text variant="muted" size="xs" style={styles.propDescText}>
{row.action}
</Text>
</Table.Cell>
<Table.Cell style={styles.tableBodyCell}>
<Badge variant="outline" size="xs">
{row.scope}
</Badge>
</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table.Root>
</div>
<Grid gap="3" style={styles.ariaGrid}>
{ARIA_CHECKLIST.map((item) => (
<VStack key={item.attr} gap="1.5" style={styles.ariaItemCard}>
<div>
<Code variant="subtle" size="sm">
{item.attr}
</Code>
</div>
<Text variant="muted" size="xs" style={styles.leadingMd}>
{item.detail}
</Text>
</VStack>
))}
</Grid>
</VStack>
{/* Footer: Feedback & Previous/Next Articles */}
<Separator />
<VStack render={<footer />} gap="6" style={styles.footerSection}>
<HStack gap="3" justify="between" wrap="wrap" style={styles.feedbackBar}>
<VStack gap="0.5">
<Text size="sm" weight="semibold">
Was this guideline helpful?
</Text>
<Text variant="muted" size="xs">
{feedbackChoice === "yes"
? "Thank you — your vote helps prioritize Solstice component specs."
: feedbackChoice === "no"
? "Thanks for letting us know. We'll expand examples in the next release."
: "Let the Solstice Design Systems team know if anything was missing."}
</Text>
</VStack>
<HStack gap="2" wrap="wrap">
<Button
variant={feedbackChoice === "yes" ? "solid" : "surface"}
size="sm"
palette={feedbackChoice === "yes" ? emeraldPalette : undefined}
aria-pressed={feedbackChoice === "yes"}
onClick={() => handleFeedback(true)}
>
<ThumbUpIcon />
Yes, helpful
</Button>
<Button
variant={feedbackChoice === "no" ? "solid" : "surface"}
size="sm"
palette={feedbackChoice === "no" ? amberPalette : undefined}
aria-pressed={feedbackChoice === "no"}
onClick={() => handleFeedback(false)}
>
<ThumbDownIcon />
Needs detail
</Button>
</HStack>
</HStack>
<Grid
render={<nav aria-label="Adjacent documentation articles" />}
gap="4"
style={styles.adjacentGrid}
>
<button
type="button"
{...stylex.props(styles.adjacentCardBtn)}
onClick={() => handleArticleNav(PREV_ARTICLE)}
>
<span {...stylex.props(styles.adjacentDirection)}>
<ArrowLeftIcon />
Previous guideline
</span>
<Text render={<span />} size="sm" weight="semibold">
{PREV_ARTICLE.title}
</Text>
<Text render={<span />} variant="subtle" size="xs">
{PREV_ARTICLE.section}
</Text>
</button>
<button
type="button"
{...stylex.props(styles.adjacentCardBtn, styles.adjacentCardEnd)}
onClick={() => handleArticleNav(NEXT_ARTICLE)}
>
<span {...stylex.props(styles.adjacentDirection)}>
Next guideline
<ArrowRightIcon />
</span>
<Text render={<span />} size="sm" weight="semibold">
{NEXT_ARTICLE.title}
</Text>
<Text render={<span />} variant="subtle" size="xs">
{NEXT_ARTICLE.section}
</Text>
</button>
</Grid>
</VStack>
</VStack>
{/* Sticky right-hand Table of Contents rail */}
<VStack
render={<aside aria-label="Article table of contents" />}
gap="5"
style={styles.tocRail}
>
<Toc.Root
items={tocItems}
defaultActiveIds={tocItems[0] ? [tocItems[0].value] : []}
multiple={false}
variant="line"
size="sm"
palette={accentPalette}
onActiveChange={({ activeIds }) => {
if (activeIds[0]) setActiveSectionId(activeIds[0]);
}}
>
<Toc.Nav>
<Toc.Title>On this page</Toc.Title>
<Toc.List>
<Toc.Indicator />
{sectionIds.map((section) => (
<Toc.Item
key={section.id}
item={{ value: section.id, depth: section.depth }}
>
<Toc.Link>{section.label}</Toc.Link>
</Toc.Item>
))}
</Toc.List>
</Toc.Nav>
</Toc.Root>
<VStack gap="3" style={styles.railMetaCard}>
<Text size="xs" weight="semibold">
Component specs
</Text>
<VStack render={<dl />} gap="2" style={styles.railMetaList}>
<HStack gap="2" justify="between">
<Text render={<dt />} variant="muted" size="xs">
Package
</Text>
<Text render={<dd />} size="xs" weight="medium" style={styles.railMetaValue}>
<Code variant="plain" size="xs">
action-button
</Code>
</Text>
</HStack>
<HStack gap="2" justify="between">
<Text render={<dt />} variant="muted" size="xs">
Gzipped
</Text>
<Text render={<dd />} size="xs" weight="medium" style={styles.railMetaValue}>
2.4 kB
</Text>
</HStack>
<HStack gap="2" justify="between">
<Text render={<dt />} variant="muted" size="xs">
Status
</Text>
<Text render={<dd />} size="xs" weight="medium" style={styles.railMetaValue}>
Stable ({version})
</Text>
</HStack>
<HStack gap="2" justify="between">
<Text render={<dt />} variant="muted" size="xs">
ARIA
</Text>
<Text render={<dd />} size="xs" weight="medium" style={styles.railMetaValue}>
Button + Menu
</Text>
</HStack>
</VStack>
<Separator />
<Button
variant="surface"
size="xs"
onClick={() => copySnippet(importStatement, "package import", "rail-import")}
>
{copiedKey === "rail-import" ? <CheckIcon /> : <CopyIcon />}
{copiedKey === "rail-import" ? "Copied import" : "Copy import"}
</Button>
</VStack>
</VStack>
</Grid>
</div>
<Toaster toaster={queue} />
</div>
);
}