Overview

Design System

Reusable demo components, documentation patterns and real CSS scenarios for the Master CSS site.

A shared visual language for explaining CSS. Quiet surfaces, precise annotations, and real browser behavior give every example a clear purpose.

Foundations

The canvas establishes context. Blue identifies the subject; violet identifies a comparison; neutral surfaces support the example without competing with it. All roles adapt to light and dark themes.

01
Quiet canvas

Structure recedes. The behavior stays in focus.

02
Honest geometry

Real CSS, real boundaries, useful annotations.

03
One visual language

A consistent system across every reference.

Canvas backgrounds
Aa
stripes
Aa
plain
Aa
grid
Aa
dots
Aa
checkerboard
Semantic color roles
Canvasdemo-canvas
Surfacedemo-surface
Subjectdemo-blue
Comparisondemo-violet
Blue identifies the subject; violet identifies a comparison. Every color is paired with a label.

Use the preset spacing, radius and typography scales. Demo-specific roles live in the site theme: demo-canvas, demo-surface, demo-line, demo-grid, demo-text, demo-muted, demo-blue, demo-violet, demo-amber, and demo-neutral.

Demo canvas

Demo uses the site's neutral fine diagonal stripe by default, matching the established Guide canvas. The shell supplies a border and responsive breathing room, while the example supplies its own layout and geometry. A title, description, controls, and caption appear only when the lesson needs them; controls remain outside the demonstrated layout.

01
02
03
<Demo>  <div className="flex gap-sm">    <DemoItem className="p-md">01</DemoItem>    <DemoItem className="p-md">02</DemoItem>  </div></Demo>

Use padding="none" for an iframe or a scene with its own spacing. background="plain", "grid", "dots", and "checkerboard" are opt-in when a lesson needs an unpatterned surface, geometry grid, or transparency cue. Do not put labels or toolbar controls inside a measured flex, grid, or float scene. The live clear reference demonstrates an isolated iframe with a caption; the spacing guide retains its original pink inner stripe where that pattern explains padding and gap.

Primitives

Compose small, predictable pieces. An item supplies its appearance; the example supplies its layout and dimensions.

Objects
01
soft
01
solid
01
outline
01
ghost
Items provide paint. Their parent supplies layout, spacing and dimensions.
Object tones
blue
violet
neutral
amber
Surfaces
DEFAULT

A stable reading surface.

RAISED

A layer above its backdrop.

The default gives content a quiet boundary. Add elevation only when the example explains a raised layer.
Content specimens
TEXT

Form follows function.

Use meaningful content to make layout decisions visible.

MEDIASun above layered mountains
Comparison
Default
Layer 01
With utility
Layer 01
Equal specimens isolate the change being taught.

Demo surface

DemoSurface keeps content legible on the striped canvas with a fine border, a compact radius and the site's raised surface color. It adds no padding, dimensions, layout, clipping or shadow by default. Use elevation="raised" only when the lesson needs to show a floating layer; it adds the preset's small shadow without changing the content box.

<DemoSurface className="p-md">A quiet content surface.</DemoSurface><DemoSurface elevation="raised" className="p-md">A floating layer.</DemoSurface>

The column span reference keeps columns and padding inside the default surface; the float reference supplies its own flow-root boundary. The original Guide panel remains in its established examples. Place any label or control outside a measured flex, grid or float layout unless it is part of the lesson.

Demo item

DemoItem starts as a neutral raised surface with a crisp border. Set tone="blue" to identify the subject or tone="violet" for a comparison. The optional soft, solid, outline, and ghost variants change paint only. The item has no implied width, height, padding, layout, position, or interactive behavior; the lesson supplies those explicitly.

<Demo>  <div className="flex gap-sm">    <DemoItem className="p-md">Context</DemoItem>    <DemoItem tone="blue" className="p-md">Subject</DemoItem>  </div></Demo>

The order reference marks the reordered item in blue. The column span reference uses the same explicit subject tone, while the spacing guide keeps its original object and pink inner stripe. DemoItem renders a noninteractive div; use a native button or link when a specimen performs an action.

Demo text

DemoText renders a native paragraph. Its default body role inherits the surrounding font size and keeps the existing margin reset and 1.65 line height, so text-flow lessons retain their geometry. Opt into variant="lead" for prominent specimen copy or variant="caption" for a short note; these roles supply type treatment without becoming extra layout items.

<DemoText variant="lead">A clear specimen heading.</DemoText><DemoText>Explanatory copy inherits its container size.</DemoText><DemoText variant="caption">Condition: narrow viewport.</DemoText>

Utilities on className can override these paint and typography defaults when the text property itself is under test. The float reference uses default body text beside an actual floated image. The typography guide retains its original DemoP comparison for the lesson on the text scale.

Demo media

DemoMedia renders a refined SVG specimen when no source is supplied. Its quiet contour artwork follows currentColor so a complete utility such as fg-demo-violet can mark a comparison. With src and required alt, it renders the supplied image instead. Both forms have a fine visual edge that takes no layout space.

<DemoMedia className="w:100% r-sm" aria-label="Sun above two mountain ridges" /><DemoMedia src="/demo/landscape.svg" alt="Sun above layered mountains" width={320} height={200} />

The caller sets width, height, crop, float and spacing. The float reference demonstrates a real floated image; the introduction guide retains its original architectural photograph where content, rather than a placeholder, is the point.

Demo swatch

DemoSwatch is a static inventory tile for semantic color roles. Its restrained frame keeps pale canvas and surface colors visible next to saturated subject and comparison colors. label is required; optional value names the token or value in a compact monospace line. An explicit utility class or style supplies the actual color.

<DemoSwatch label="Subject" value="demo-blue" className="bg-demo-blue" />

The color patch is decorative when it has no children, while the visible label carries the meaning. This tile has no copy action or focus stop. The colors guide retains its original interactive palette for browsing and copying fixed color steps.

Demo comparison

DemoComparison arranges direct children in responsive columns. The adopted layout gives each specimen a 17rem reading minimum and uses the site's large spacing step between columns. The specimens stack when there is not enough room for both; the wrapper adds no frame, padding, labels or paint. Give each child its own dimensions and utilities so the comparison shows the actual property under discussion.

<Demo>  <DemoComparison>    <DemoSurface className="p-md">Before</DemoSurface>    <DemoSurface elevation="raised" className="p-md">After</DemoSurface>  </DemoComparison></Demo>

The “Content specimens” and “Comparison” examples above use this layout. The elevation guide retains its original spacious comparison grid, while the comparison review shows that grid beside the previous and adopted shared treatments. Place comparison labels outside any measured flex, grid or float scene.

Badge sizes
XSSML
Badge treatments
DraftSelectedComparisonNote

DemoBadge labels a state or category. It renders a native span with four sizes (xs, sm, md, lg), the shared tones and the same paint variants as DemoItem. The default is a neutral, soft, medium badge. Its compact radius, tabular monospace text and font-relative padding are explicit; keep badges outside measured layouts unless their dimensions are part of the lesson. Use a native button when the label performs an action. The badge review compares the Guide label, earlier badge and adopted treatment.

<DemoBadge tone="blue" size="sm">Selected layer</DemoBadge>
<Demo title="Alignment" background="grid">  <div className="flex items-center gap-sm">    <DemoItem className="p-md">01</DemoItem>    <DemoItem tone="violet" className="p-md">02</DemoItem>  </div></Demo>

Downloadable assets

DemoAsset pairs original artwork with a named surface and a native download link. Use it for logos, icons or exported diagrams; it is a presentation frame, not a measured CSS layout. Intrinsic image dimensions reserve the aspect ratio. The preview constrains images to the available width and a 6rem height without cropping. The image remains transparent over the chosen preview surface in either page theme.

Master CSS mark
Transparent is the default surface.
Master CSS gold mark
<DemoAsset  title="Master CSS mark"  description="Original SVG artwork."  src="/images/logo.svg"  alt="Master CSS gold mark"  width={104}  height={56}/>

Use surface="light" or surface="dark" to keep the preview background fixed across page themes. surface="transparent" uses a checkerboard. The footer stays outside the artwork and exposes the file format (SVG by default). Use same-origin URLs for native downloads and a descriptive title for each accessible download name. See the Brand page for the light, dark and transparent variants together, and the asset review for original, previous and adopted treatments.

Annotations

Name the subject, reveal a boundary, or expose an axis. Keep annotations outside the layout being demonstrated. Use color with labels, never as the only explanation.

Anatomy of a layout
Main axis
Cross axis
ContainerMeasuring…
01
02
03
  • Subject
  • Comparison
  • Context

DemoMeasure observes its content boundary and updates as the container changes. DemoAxes and DemoLegend describe the relationship without inserting items into the measured flex or grid parent.

Demo label

DemoLabel identifies a class, object or condition with a compact monospace line. The adopted treatment is a little larger and clearer than the earlier shared label, with tabular numerals and wrapping for long utilities. It adds no background, border or spacing; the scene sets the distance to its subject.

<div>  <DemoLabel>shadow-sm</DemoLabel>  <DemoSurface className="mt-xs p-md">Standard surface</DemoSurface></div>

Keep a label outside the measured flex or grid parent unless it is part of the layout lesson. The elevation guide retains its original labels, and the label review shows those beside the previous and adopted shared styles.

Demo legend

DemoLegend is a separate key for recurring color roles. Each item pairs a short name with a small bordered swatch, and the list wraps as space narrows. Its compact monospace text follows the shared label scale; the swatches are decorative, so the names carry the meaning. Place the legend in the demo caption or beside its description, outside the measured layout.

<Demo caption={<DemoLegend items={[  { tone: 'blue', label: 'Subject border' },  { tone: 'violet', label: 'Comparison border' },]} />}>  {/* The lesson's two border specimens live here. */}</Demo>

Include only roles visible in the scene. The border color reference labels its blue and violet specimens directly; the legend review compares that teaching pattern with the previous and adopted shared keys.

Demo measure

DemoMeasure observes the rendered content boundary and displays its width and height in pixels. The adopted annotation separates the name from the numeric readout, with a fine ruler spanning the observed wrapper. It updates when the available width or the content height changes; a requested CSS width can differ from the measured width inside a narrow column.

<DemoMeasure label="Content bounds">  <DemoSurface className="p-md">Measured content</DemoSurface></DemoMeasure>

Place the measurement wrapper outside the flex, grid or float parent being taught, so it does not become an extra layout item. The width reference reports the actual browser geometry for its examples. The measure review tests live width and height changes beside the original Guide layout ruler.

Demo axes

DemoAxes puts a labeled horizontal rule and vertical rule around one example. Its default main-axis arrow points right and its cross-axis arrow points down, matching a left-to-right row in horizontal writing. The rules are decorative; the text supplies the axis names. The adopted treatment gives the labels a clear monospace scale and keeps both rules outside the example's flex layout.

<DemoAxes aria-label="Row layout: main axis rightward, cross axis downward">  <div className="flex gap-sm">{/* layout items */}</div></DemoAxes>

Use this frame only when those physical directions match the specimen; reverse and vertical examples need annotations that follow their actual directions. The flex direction reference shows the real row behavior, and the axes review compares the original Guide labels with the previous and adopted frame.

Interaction

Add controls when they help explain a change. Static specimens have no toolbar. Playback-controlled specimens start paused; bounded scroll areas remain keyboard accessible.

Controls with a purpose
Cross-axis alignment
01
02
03
Controls sit outside the measured layout. Selection changes the actual utility class.
Motion
↗
Animation controls
Animation starts only when requested. Replay returns every animation to its starting time.
Scroll region
01Background
02Composition
03Typography
04Annotations
05Export
A keyboard-focusable, bounded region keeps scrolling local to the example.

Demo controls

DemoControls is a fieldset with an accessible group name. Its plain default leaves mixed sliders, action buttons and print controls ungrouped. For a small set of exclusive choices, use variant="segmented": the selected native button has a separate surface and keeps aria-pressed, while a visible focus outline supports keyboard use. Both appearances stay outside the layout being demonstrated.

<DemoControls label="Cross-axis alignment" variant="segmented">  <button type="button" className="demo-button" aria-pressed={alignment === 'items-start'}>Start</button>  <button type="button" className="demo-button" aria-pressed={alignment === 'items-center'}>Center</button>  <button type="button" className="demo-button" aria-pressed={alignment === 'items-end'}>End</button></DemoControls>

The controls review compares both shared appearances with the original Syntax Tutorial viewport switch, which retains its own controls.

Demo scroll area

DemoScrollArea establishes native overflow and a keyboard focus stop. Its adopted fine border, compact radius and quiet surface make the scroll boundary visible against the diagonal canvas. The component caps its height at 16rem; set an explicit width or smaller height for the lesson. It does not add a child or change how content is laid out inside the scrollport.

<DemoScrollArea role="region" aria-label="Layer collection" className="h:10rem">  {/* Overflowing content */}</DemoScrollArea>

Give a named region when the collection needs a landmark, and keep the focus outline visible. The overflow reference uses real utility classes on its scrollports; the scroll area review compares the original Guide pattern, previous shared component and adopted boundary.

Demo viewport

DemoViewport hosts a complete site-authored document in a real iframe. The adopted treatment gives that viewport a fine edge and a quiet control deck, while preserving its actual width, height and content. A named preset, range slider or Fit changes the iframe width; theme, motion and print add only the controls needed by a lesson.

<DemoViewport  title="Responsive specimen"  document={html}  responsive  widthPresets={[{ label: 'Below sm', width: 833 }, { label: 'At sm', width: 835 }]}  height={180}/>

Derive breakpoint widths from the active preset; the numbers above illustrate the current sm boundary. A wide preset remains wide inside a narrow phone and scrolls within the stage. The padding reference responds to its iframe viewport, and the viewport review shows the original Guide control, previous shared chrome and adopted frame.

Demo motion

DemoMotion wraps an authored animation in a framed stage and places native Play/Pause and Replay buttons in a separate deck. It starts paused and uses the browser animation timeline: Pause preserves the current frame; Replay returns to the start before playing. The component also pauses when the operating system motion preference changes. Keep the movement, duration and easing in the specimen’s actual class or CSS.

<DemoMotion>  <div className="grid place-items:center h:10rem">    <DemoItem className="width:4rem height:4rem animation:rotate|2s|linear|infinite">↗</DemoItem>  </div></DemoMotion>

The stage adds no layout padding or dimensions, so set those in the example. The animation play-state reference uses its own real checkbox and CSS condition; the motion review compares the original Guide token scene with the previous and adopted shared playback treatment.

Document indexes

DocumentationIndex organizes a large catalog by section, category or letter. It powers the Guide and Reference entrances. Use complete descriptions for learning paths, and compact link lists for named API or utility lookups. Both views contain the same destinations.

Provide a stable id, title, description, icon and groups for each section. Groups with multiple categories receive native anchor shortcuts; give each group its own stable id so shared URLs survive reordering. showDescriptions enables complete, wrapping summaries. The default uses compact links. related supplies a cross-link to the other catalog.

<DocumentationIndex  name="guide"  sections={[{    id: 'learn', title: 'Learn',    description: 'Start with a working example.', Icon: IconBook,    groups: [{ entries: [{      id: 'intro', title: 'Introduction', category: 'Guide',      description: 'Write your first classes.',      url: '/guide/introduction',    }] }],  }]}  showDescriptions  related={{ href: '/reference', title: 'Reference',    description: 'Look up a utility.', Icon: IconBook }}/>

The catalog keeps the established card grid, with restrained icon boxes, clearer heading hierarchy and full mobile touch targets. It establishes its own container and column layout; place it in the reading column, outside measured demos. Category and A–Z controls are native buttons with pressed states. Letter and category shortcuts are real fragment links, including direct-entry URLs. Published catalogs omit idPrefix to retain their existing anchors; set distinct prefixes only when showing several catalogs on one review page. The complete category view is included in server-rendered HTML; A–Z switching requires JavaScript. The index review compares the original, previous and adopted treatments.

Document steps

Use DocumentSteps for a setup sequence with authored headings and code. Each DocumentStep gets a decorative two-digit number through DocumentStepNumber. Keep the action in the heading and its expected result in the prose. Reading order stays in the document.

Create an entry

This default step spans the reading column. Longer explanations, native lists and full-width examples can stay together.

Connect the stylesheet

The column variant pairs instructions with code when its own container has room. Narrow columns stack with an explicit gap.

src/style.css
@import "@master/css";
<DocumentSteps>  <DocumentStep columns>    <DocumentStepText>      <h3><DocumentStepNumber />Connect the stylesheet</h3>      <p>Import the entry in your app.</p>    </DocumentStepText>    <DocumentStepBody>{code}</DocumentStepBody>  </DocumentStep></DocumentSteps>

The components are server rendered. Supply native headings at the appropriate level and preserve their stable IDs. Numbering is decorative, not a replacement for headings or a progress indicator. The fine numbered rail inherits the original Guide’s sequence cue. The 36rem container threshold controls the optional two-column layout; narrower columns stack in reading order, and code retains its own horizontal scroll. Place measured demos outside the step layout. The steps review compares the original Guide, previous shared style and adopted treatment.

Use the same sequence pattern across installations:

Place a complete template before its appearance preview. DemoConfiguredExample uses literal source to keep displayed classes and rendered samples aligned; a preview does not run the host framework. Keep setup constraints in the lesson.

Installation mode navigation

InstallationModeTabs reuses the site’s navigation treatment for sibling setup guides. Pass translated labels and canonical destinations. One matching link receives aria-current="page". These are ordinary links with native keyboard behavior, not an in-page tab panel. The Blazor installation guide starts with static rendering; runtime rendering has its own route.

<InstallationModeTabs items={[  { href: '/guide/installation/blazor', label: 'Static Rendering' },  { href: '/guide/installation/blazor/runtime', label: 'Runtime Rendering' },]} />

Document values

Use DocumentValueList for reference facts that need a stable anchor and readable values. It keeps a compact key/value arrangement when the content column has room, then stacks each entry on narrow screens. Long values wrap without hiding content.

fast

--duration-fast
Default.15s

raised

--color-surface-raised
lightvar(--color-white)
darkvar(--color-gray-90)

smooth

--easing-smooth
Defaultcubic-bezier(.4, 0, .2, 1)
<DocumentValueList rows={[  { id: 'duration-fast', title: 'fast', identifier: '--duration-fast',    values: [{ label: 'Default', value: '.15s' }] }]} /><DocumentKeyList keys={['animation-duration:', 'transition-duration:']} />

Each row uses a real heading and an ordinary anchor link. IDs must be unique within the page; headingLevel={4} supports an entry nested below an existing third-level heading. Values remain selectable text. Use DemoTokenTable for token roles with visual specimens, and the existing code renderer for complete source examples. Both document components are static and live outside measured demo layouts.

Namespace consumers

Use DocumentNamespaceTable to map a namespace to its complete public consumers. Large rows show six keys initially; the native disclosure reveals the rest by mouse, touch, Enter or Space. All keys remain in the HTML and portable Markdown. This server component requires no client state and stays outside teaching geometry.

NamespaceConsumers
color-text-*
  • -webkit-text-fill-color-
  • caret-color-
  • color-
  • fg-
  • text-
  • text-decoration-
Show 2 more keys
  • text-decoration-color-
  • text-fill-color-
duration-*
  • animation-
  • animation-delay-
  • animation-duration-
  • transition-
  • transition-delay-
  • transition-duration-
spacing-*
  • background-position-
  • border-spacing-
  • bottom-
  • column-gap-
  • cx-
  • cy-
Show 123 more keys
  • gap-
  • gap-x-
  • gap-y-
  • inset-
  • inset-block-
  • inset-block-end-
  • inset-block-start-
  • inset-inline-
  • inset-inline-end-
  • inset-inline-start-
  • ix-
  • ixe-
  • ixs-
  • iy-
  • iye-
  • iys-
  • left-
  • m-
  • margin-
  • margin-block-
  • margin-block-end-
  • margin-block-start-
  • margin-bottom-
  • margin-inline-
  • margin-inline-end-
  • margin-inline-start-
  • margin-left-
  • margin-right-
  • margin-top-
  • mask-position-
  • mb-
  • ml-
  • mr-
  • mt-
  • mx-
  • mxe-
  • mxs-
  • my-
  • mye-
  • mys-
  • object-position-
  • outline-offset-
  • p-
  • padding-
  • padding-block-
  • padding-block-end-
  • padding-block-start-
  • padding-bottom-
  • padding-inline-
  • padding-inline-end-
  • padding-inline-start-
  • padding-left-
  • padding-right-
  • padding-top-
  • pb-
  • perspective-
  • perspective-origin-
  • pl-
  • pr-
  • pt-
  • px-
  • pxe-
  • pxs-
  • py-
  • pye-
  • pys-
  • right-
  • row-gap-
  • scroll-m-
  • scroll-margin-
  • scroll-margin-block-
  • scroll-margin-block-end-
  • scroll-margin-block-start-
  • scroll-margin-bottom-
  • scroll-margin-inline-
  • scroll-margin-inline-end-
  • scroll-margin-inline-start-
  • scroll-margin-left-
  • scroll-margin-right-
  • scroll-margin-top-
  • scroll-mb-
  • scroll-ml-
  • scroll-mr-
  • scroll-mt-
  • scroll-mx-
  • scroll-mxe-
  • scroll-mxs-
  • scroll-my-
  • scroll-mye-
  • scroll-mys-
  • scroll-p-
  • scroll-padding-
  • scroll-padding-block-
  • scroll-padding-block-end-
  • scroll-padding-block-start-
  • scroll-padding-bottom-
  • scroll-padding-inline-
  • scroll-padding-inline-end-
  • scroll-padding-inline-start-
  • scroll-padding-left-
  • scroll-padding-right-
  • scroll-padding-top-
  • scroll-pb-
  • scroll-pl-
  • scroll-pr-
  • scroll-pt-
  • scroll-px-
  • scroll-pxe-
  • scroll-pxs-
  • scroll-py-
  • scroll-pye-
  • scroll-pys-
  • shape-margin-
  • stroke-dashoffset-
  • text-indent-
  • text-underline-
  • text-underline-offset-
  • top-
  • transform-origin-
  • translate-
  • word-spacing-
  • x-
  • y-
<DocumentNamespaceTable rows={[  { namespace: 'font-family', consumers: ['font:', 'font-family:'] }]} /><DocumentKeyList keys={consumerKeys} previewCount={6} />

DocumentKeyList shows every key by default. Set previewCount when a long lookup list would interrupt reading; keep essential instructions outside the disclosure. See the complete namespace registry.

Utility namespace table

NamespaceUtilityTable connects a token namespace to the utility keys that accept it. When groups have descriptions, the table keeps the original Guide's separate Group, Utility keys and Description columns. The refined shared style uses quiet separators and a consistent reading rhythm. On narrow screens the table scrolls inside its own keyboard-focusable region; the page width stays fixed.

Utility groups table
GroupUtility keysDescription
SurfacessurfacePanels, cards and overlays.
Line rolesb, border-color, outline-color, strokeBorders, outlines and SVG strokes.
<NamespaceUtilityTable groups={[  { label: 'Surfaces', namespace: 'color-surface',    keys: ['surface'], description: 'Panels, cards and overlays.' }]} />

Provide reader-facing group names and source keys from the manifest; namespace or namespaces filters unsupported keys. With no descriptions the table uses two columns. The table is a document aid, outside the measured layout of a demo. See its actual uses in Colors, Spacing and Typography, and the original/current/adopted review.

Numeric token table

ThemeNumberVariableTable reads numeric tokens and their units from the preset. The spacing representation uses the original Guide's pink diagonal field and raised objects to expose each actual gap. Its table has stable token and value columns, quiet row separators, and a keyboard-focusable scroll region on narrow screens.

Numeric theme variables
TokenValuePXRepresentation
--spacing-4xs.125rem2px
--spacing-3xs.25rem4px
--spacing-2xs.375rem6px
--spacing-xs.5rem8px
--spacing-sm.75rem12px
--spacing-md1rem16px
--spacing-lg1.5rem24px
--spacing-xl2rem32px
--spacing-2xl3rem48px
--spacing-3xl4rem64px
--spacing-4xl6rem96px
--spacing-5xl8rem128px
<ThemeNumberVariableTable namespace="spacing" representation="spacing" />

The representation prop is optional. Breakpoints and Containers use the same data-driven table with descriptions, without the spacing specimen. Keep the native token value and reference unit visible in text, and place this inventory outside a measured layout demo. The numeric table review compares the original pink field with the previous neutral treatment and the adopted shared style.

File structure

Use DocumentFileTree for a static directory structure. Native nested lists preserve the hierarchy; monochrome icons are decorative. Entries can have a short description and nested children.

Independent applications, shared vocabulary
  • projects/
    • admin/
      • package.jsonDeclares Master CSS dependencies
      • index.cssAdmin entry and local overrides
    • shop/
      • package.jsonDeclares Master CSS dependencies
      • index.cssShop entry
  • index.cssShared tokens and components
  • package.jsonRepository scripts and workspace tooling

Each app has a project root. Both import the same shared CSS source.

<DocumentFileTree title="Stylesheet package" entries={[  { name: 'package.json' },  { name: 'master.css', description: 'Public CSS source' },  { name: 'assets', children: [], description: 'Optional assets' }]} />
Stylesheet package
  • package.json
  • master.cssPublic CSS source
  • assets/Optional assets

The optional caption belongs below the hierarchy. Keep descriptions short; they wrap below filenames in the reading column. Empty children marks an empty folder. This is a read-only list, so entries have no tab stops, expansion state or tree-widget keyboard behavior.

Use the same entry data when exporting a plain-text tree. See Monorepo and Authoring Packages for complete examples.

Discovery waterfall

DemoWaterfall shows illustrative request order with a text description and labeled resource rows. It has no time axis, FCP marker or animated playback. Keep measured results in the benchmark components.

Discovered by the runtime
HTML exposes the stylesheet and script. The manifest waits until the runtime entry executes.
  • HTML
  • Base CSS
  • Runtime script
  • Manifest JSON
Illustrative order · no time scale
Manifest exposed in HTML
A JSON module hint makes the manifest discoverable while the document is parsed.
  • HTML
  • Base CSS
  • Runtime script
  • Manifest JSON
Illustrative order · no time scale
<DemoWaterfall  title="A dependency discovered later"  description="The second request becomes known after the first resource loads."  rows={[    { label: 'Entry', start: 0, end: 40, tone: 'violet' },    { label: 'Dependency', start: 50, end: 90, tone: 'blue' }  ]}/>
A dependency discovered later
The second request becomes known after the first resource loads.
  • Entry
  • Dependency
A compact two-resource diagram.

Positions range from 0 to 100 and describe drawing geometry only. Use a description that explains the dependency in words; decorative bars are hidden from assistive technology. Rows stack their labels above the tracks in narrow containers. See critical resources. The waterfall review compares that Guide timeline, the earlier shared diagram and the adopted treatment.

Before and after CSS

DemoStyleComparison places identical, trusted HTML in two isolated browser documents. One uses native browser defaults; the other receives the supplied CSS. This makes the change in layout visible without flashing content or changing the surrounding page.

Browser defaults
HTML without author CSS
CSS applied
The same HTML with author CSS
<DemoStyleComparison  html='<p class="message">Saved to your workspace.</p>'  css='.message { padding: 1rem; font: 500 1rem/1.5 system-ui; }'  height={160}/>
Browser defaults
HTML without author CSS
CSS applied
The same HTML with author CSS

The previews use the same fixed height, with native scrolling when needed. The comparison grid owns layout outside each iframe; the unstyled document receives no demo reset or object styles. Pass site-authored markup only. See first-paint styling.

Document flow

DocumentFlow presents a short ordered process using real text and native list semantics. Numbered stages share the reading column on wide screens and stack when space is limited. It is a static explanation; the layout does not imply timings or an active step.

Runtime delivery
  1. Observe

    Read connected elements and receive DOM class changes.

  2. Ensure

    Interpret complete classes with the project manifest.

  3. Update

    Insert or reuse native CSS rules in the runtime stylesheet.

DOM usage and cached CSS rules have separate lifecycles.

<DocumentFlow  title="Publish a document"  steps={[    { title: 'Write', description: 'Prepare the source content.' },    { title: 'Publish', description: 'Deliver the reviewed output.' }  ]}/>
Publish a document
  1. Write

    Prepare the source content.

  2. Publish

    Deliver the reviewed output.

Use two to four concise stages. An optional caption explains shared constraints below the stages. The component owns its grid, spacing and border; keep it outside any layout being measured. No controls, focus stops or animation are added.

DeliveryFlow supplies shared, exportable recipes for runtime and hydration, source scanning, native pruning and route styles. Their ordered text is included in search and Markdown.

Document choices

Use DocumentChoices for a small set of related destinations inside a reading column. Every link has a title, a short description and an optional decorative icon. Rows have generous click targets, a visible keyboard outline and native list semantics. Keep the whole row as one link; do not nest controls inside it.

<DocumentChoices label="Related guides" entries={[  { title: 'Theme Tokens', description: 'Shared product values.', href: '/guide/theme' }]} />

MigrationGuides adds the existing brand artwork and reads the same seven entries used by search and Markdown exports. See the migration overview. Use DocumentationIndex for large catalogs that need categories and alphabetical navigation. These navigation components sit outside teaching layouts.

Reading comparisons

Wrap a two-column Markdown table in DocumentComparison when readers need to compare prose or class syntax within the document column. Both columns stay visible on narrow screens; long syntax wraps. Use lists for decisions that need several paragraphs, and code blocks for source that must preserve its formatting. This static wrapper keeps native table headers and does not add demo geometry.

Existing CSSMaster CSS
border-radius: .75remr:.75rem preserves the same length.
width: var(--progress)w:var(--progress) reads the same runtime property.
@media (width >= 72rem)Define --breakpoint-dashboard: 72rem, then use @dashboard.
<DocumentComparison>| Existing CSS | Master CSS || --- | --- || `border-radius: .75rem` | `r:.75rem` |</DocumentComparison>

See migration utility mappings and rendering choices.

Syntax mappings

Use DocumentCodeTable for short syntax tokens paired with their native CSS. Row headers keep each token intact; CSS wraps at natural spaces. Keep long generated rules in code blocks. The table is a static reading aid, outside demo geometry.

TokenCSS
@component@layer components
@reduce-motion@media (prefers-reduced-motion: reduce)
@supports(<feature>)@supports (<feature>)
<DocumentCodeTable label="Token" rows={[  { syntax: '@component', css: '@layer components' },  { syntax: '@reduce-motion', css: '@media (prefers-reduced-motion: reduce)' }]} />

The default first-column label is “Syntax”. The conditions reference uses this pattern for both named variants and arbitrary queries. Portable Markdown retains the original two-column table and every value.

Tool contracts

Use DocumentParameters for API inputs whose identifiers, types, and explanations need the full reading width. Required and optional states use text; neither is a validation control. Nested paths retain their full names and state when their parent is needed.

className
stringRequired

One complete class, including any selector or condition suffix.

mode
stringOptional

Use the active manifest’s default behavior when omitted.

range.start.character
integerRequired when parent is provided

Zero-based UTF-16 code-unit offset. Keep the full path visible so readers can build the correct request object.

Complete input schema
{  "type": "object",  "properties": { "className": { "type": "string", "minLength": 1 } },  "required": ["className"]}
Expanded supporting detail

Native disclosure keeps supporting content in the document and lets readers use the keyboard to open or close it. Essential instructions belong outside the disclosure.

<DocumentParameters label="Parameters" parameters={[  { name: 'className', type: 'string', requirement: 'Required', description: 'One complete class.' }]} /><DocumentDisclosure title="Complete input schema">  <Code lang="json">{schema}</Code></DocumentDisclosure>

Place both components in document flow, outside the layout being demonstrated. Use a plain sentence for an empty parameter list. Long code can scroll inside a disclosure; parameter descriptions wrap naturally. Keep the full contract in portable Markdown and search even when the page initially collapses it.

Used by class inspection, directive formatting, and CLI generation.

Tooling documentation

Use a readable option list for long identifiers, and a labeled source/result pair when explaining a tool. These static examples are checked against the actual lint and language-service output with the default preset.

masterCSS.suggestSyntax
Defaulttrue

Offer contextual completion items.

masterCSS.inspectSyntax
Defaulttrue

Show generated CSS on hover.

masterCSS.renderSyntaxColors
Defaulttrue

Provide resolved color information to the editor.

masterCSS.formatDirectives
Defaulttrue

Normalize directive source in CSS-family files and supported style blocks.

masterCSS.embeddedSyntaxHighlighting
Defaultactive

Choose active, always, or off for embedded class highlighting.

masterCSS.workspaces
Defaultauto

Discover project boundaries automatically, or supply workspace directory globs.

p-sm

(token --spacing-sm) .75rem

p-md

(token --spacing-md) 1rem

p-lg

(token --spacing-lg) 1.5rem

A stable class order
Before sorting
bg-blue-60 p-md flex gap-sm
After sorting
flex gap-sm p-md bg-blue-60
A recognized class with an invalid value
Source
<span class="text-decoration:bad()">Note</span>
Error@master/css/no-invalid-classes

Class "text-decoration:bad()" emits invalid CSS: Invalid value for `text-decoration` property.

CSS reported by hover
Source
<button class="fg-white bg-blue-60:hover@sm">  Save</button>
Hover output
@layer theme {  :root,  :host {    --color-blue-60: oklch(51.83% .2687 266.1)  }}@layer utilities {  @media (width>=52.125rem) {    .bg-blue-60\:hover\@sm:hover {      background-color: var(--color-blue-60)    }  }}

DocumentOptions keeps each identifier above its optional default and description. It uses native definition-list semantics; long names and values wrap without shrinking the prose into a narrow table cell. For prose authored directly in MDX, compose DocumentOptionList and DocumentOptionEntry; the paragraphs, links and inline code remain part of the portable document.

<DocumentOptionList label="Component interfaces">  <DocumentOptionEntry name="DemoSurface">    **Interface:** `elevation`, native div props.    A bordered surface with no implicit layout or padding. Elevation is opt-in.  </DocumentOptionEntry></DocumentOptionList>

Keep these document lists outside measured specimens. Each entry owns one term and its description; use ordinary paragraphs for separate interface details and layout constraints.

<DocumentOptions label="Feature settings" options={[  {    name: 'masterCSS.suggestSyntax',    defaultValue: 'true',    description: 'Offer contextual completion items.'  }]} />

DocumentCodeExample reuses the shared syntax highlighter. Source-only examples may show an error or warning; paired examples can use different source and result languages. Each block has a keyboard-accessible copy button and clipboard feedback. It remains readable when copying is unavailable.

<DocumentCodeExample  title="A stable class order"  language="mcss"  source="p-md flex"  result="flex p-md"  sourceLabel="Before sorting"  resultLabel="After sorting"/>

Use complete, verified strings. Code keeps its whitespace and may scroll inside its block; the option descriptions remain fluid. Neither component belongs inside a measured CSS lesson's flex or grid geometry. Keep the full text in the content export adapter.

See Code Linting for sorting, canonical forms, conflicts and diagnostic variants, and Language Service for completion, hover and formatter output.

Agent documentation

Prompts are prose that readers copy into another tool. DocumentPrompt preserves the exact text, wraps long lines, and keeps the copy action visible without presenting an editable field or a simulated chat.

Feature styling
Style this feature with Master CSS.

Reuse the project's tokens and component classes. Keep one-off layout decisions in markup. Add a shared token only for a repeated value or a named product decision.

Preserve HTML semantics, accessibility, and behavior. Run the available checks and inspect the result in the browser.
Register the local server
Set up the Master CSS MCP server for this project.

Project root: /absolute/path/to/project
Command: npx -y @master/css-mcp@rc --root /absolute/path/to/project

Identify the MCP client and use its native registration path. Do not assume every client reads mcp.json. Keep machine-specific absolute paths out of team configuration unless requested.

Verify the registration, reconnect the client if needed, then call mastercss_workspace_info. Confirm the returned root and manifest entries match this project.
From proposal to verified change
  1. Preview

    Request a scoped diff. The server leaves workspace files unchanged and returns a token when changes exist.

  2. Review

    Check the full diff and intended behavior before asking the client to apply it.

  3. Apply and verify

    Apply the reviewed token. The server checks expiry, paths, and source hashes; then run project checks and inspect the UI.

A token belongs to one running server session. A restart, expiry, or successful application requires a new preview.

One-file sort preview
src/button.html — before
<button class="bg-blue-60 p-md flex gap-sm">Save</button>
Proposed content
<button class="flex gap-sm p-md bg-blue-60">Save</button>
Reuse a project button
The same btn class provides hover, keyboard focus, and native disabled states. These buttons demonstrate styling; they do not save data.
<DocumentPrompt  title="Review a component"  text="Review this component's classes and keyboard behavior."/>

Use a short title describing the task. Keep paragraphs and lists in the text itself so clipboard and portable exports preserve the full instructions. Short tasks and longer setup prompts use the same layout; both wrap within the reading column. The server renders the text and only the copy button needs client state.

Combine prompts with DocumentOptions for tool names, DocumentFlow for an ordered workflow, and DocumentCodeExample for verified before/after content. A workflow diagram does not execute a tool or imply that approval has been given. Keep prompts outside any measured demo geometry, and use ordinary code blocks when whitespace-sensitive source needs horizontal scrolling.

See AI Coding for context, review, and project-rule recipes, and MCP Server for the actual preview/apply process. The button specimen reuses the guide's configuration, HTML, and generated CSS.

Package APIs

DocumentAPIIndex keeps import paths and export names together with their purpose. It is a server-rendered navigation list: identifiers wrap at path separators and word boundaries without changing copied text, and each destination is a normal keyboard-accessible link. Use the compact variant for a list of symbols inside DocumentDisclosure.

Example exports
TypeScript
export declare function createEngine(  options: MasterCSSEngineOptions): Promise<MasterCSSEngine>;
TypeScript
export interface MasterCSSCompileOptions {  readonly classes?: readonly string[];  readonly from?: string;  readonly preserveNativeCSS?: boolean;  readonly preserveNativeSource?: boolean;  readonly onDiagnostic?: (diagnostic: MasterCSSDiagnostic) => void;}
Complete declaration · 62 lines
TypeScript
export interface MasterCSSInspectionReport {    readonly version: 4;    readonly cwd: string;    readonly inputs: Readonly<{        patterns: readonly string[];        files: readonly string[];        classes: readonly string[];    }>;    readonly scanner: Readonly<{        counts: Readonly<{            latent: number;            valid: number;            invalid: number;            native: number;            usedNative: number;            safelist: number;            blocklist: number;        }>;        classes: Readonly<{            latent: readonly string[];            valid: readonly string[];            invalid: readonly string[];            native: readonly string[];            usedNative: readonly string[];            safelist: readonly string[];            blocklist: readonly string[];        }>;        resetDependencies: readonly string[];    }>;    readonly stylesheets: Readonly<{        entries: readonly MasterCSSStylesheetInspection[];        dependencies: readonly string[];        warnings: readonly string[];        errors: readonly MasterCSSStylesheetError[];    }>;    readonly css: Readonly<{        bytes: number;        included: boolean;        text?: string;        emittedGlobals: Readonly<{            variables: number;            animations: number;        }>;    }>;    readonly missingCSS: Readonly<{        checked: readonly string[];        present: readonly MasterCSSMissingCSSResult[];        missing: readonly MasterCSSMissingCSSResult[];    }>;    readonly files: readonly MasterCSSSourceInspection[];    readonly inspections: readonly MasterCSSClassValidation[];    readonly diagnostics: readonly MasterCSSInspectionDiagnostic[];    readonly summary: Readonly<{        files: number;        stylesheets: number;        diagnostics: number;        errors: number;        warnings: number;        missingCSS: number;        invalidClasses: number;    }>;}

DocumentDeclaration reuses server syntax highlighting and the shared keyboard copy control. Declarations above 40 lines use a native disclosure; their full text stays in the document and portable exports. Long code lines scroll inside the code block. The component does not compile or execute TypeScript. Copy controls become available after client initialization; reading and native disclosures work before it.

<DocumentAPIIndex label="Import paths" entries={[  { name: '@master/css', href: '/reference/packages/css',    description: 'Engine sessions and class rendering.' }]} /><DocumentDeclaration label="Engine factory">{declaration}</DocumentDeclaration>

Keep these reading components outside demo geometry. Package pages derive declarations from TypeScript emission and retain public overloads, types, stable anchors and constructor restrictions. See Compiler, Runtime and Tooling for complete examples.

Stylesheet examples

Use StylesheetExample when a CSS directive changes the emitted stylesheet. The server compiles the literal source with the current preset and displays the complete result, including required variables and keyframes. The pair reuses DocumentCodeExample, including keyboard copy, visible focus and clipboard feedback. It does not execute a visual effect in the page.

A token used by a native rule
Source
@theme {  --color-brand: #4f46e5;}.card {  background-color: var(--color-brand);}
Result
.card {  background-color: var(--color-brand);}@layer theme {  :root,  :host {    --color-brand: #4f46e5  }}
An inline token
Source
@theme inline {  --color-brand: #4f46e5;}@safelist "bg-brand";
Result
@layer utilities {  .bg-brand {    background-color: #4f46e5  }}
A resource without a matching class
Source
@theme static {  --color-brand: #4f46e5;  @keyframes fade-in {    to { opacity: 1; }  }}
Result
@layer theme {  :root,  :host {    --color-brand: #4f46e5  }}@keyframes fade-in {  to {    opacity: 1  }}
scope

An optional root selector. See Project settings for the defaults.

<StylesheetExample  title="An inline color token"  source={`@theme inline { --color-brand: #4f46e5; }@safelist "bg-brand";`}/>

The component accepts a title and standalone CSS source. Use a fixture-backed example for imports, references or assets that need multiple files. Keep the compiler on the server, retain every source and result line in portable Markdown, and allow code to scroll within its own block. A build error must surface during documentation checks.

The default, inline and static examples above share one presentation. DocumentOptions also accepts inline code and links in its description; its name and optional default stay separate. Both components belong outside measured demo layouts.

See Theme and variants, Managed definitions and Conditional blocks for working uses.

Benchmark charts

Use BenchmarkBars for values on a shared scale and BenchmarkStackedBars for composition within each row. The examples below use illustrative data, not measured results. See Benchmarks for real fixtures, sources, and limits.

BenchmarkChartGroup pairs a clearer metric heading with its unit and sample context, while leaving the established bars intact. The chart group review compares the original Guide chart, previous wrapper and adopted treatment. BenchmarkMetrics renders a refined definition list for short summaries, with tabular values and a detail line that stacks in narrow columns; its metrics review keeps the original Guide table visible. BenchmarkDataTable uses a refined native disclosure and a named, keyboard-focusable scroll region, so long tables retain complete rows and columns; its data table review preserves the Guide's original Expand control. BenchmarkSource marks a committed snapshot beside its recorded date; the source review compares it with the full Guide source table. BenchmarkFigure, BenchmarkDelta, and BenchmarkSampleSummary provide captions, contextual deltas, and sample statistics.

Keep series labels visible, include units and sample counts, and distinguish zero from missing data. Labels wrap; values use tabular numerals. A zero value has no colored fill. Stacked rows normalize to their own totals, so their lengths do not compare absolute payload size. Put important findings and limitations in the document body as well as the chart caption.

import { BenchmarkChartGroup, BenchmarkDataTable, BenchmarkSource } from '~/site/components/benchmarks'<BenchmarkChartGroup title="Style recalculation" detail="Median · 3 samples" unit="ms"  items={[{ id: 'fixture-a', label: 'Fixture A', value: 12.5, color: 'blue' }]} /><BenchmarkDataTable title="All recorded measurements">  <table>    <thead><tr><th scope="col">Fixture</th><th scope="col">Median</th></tr></thead>    <tbody><tr><th scope="row">Fixture A</th><td>12.5 ms</td></tr></tbody>  </table></BenchmarkDataTable><BenchmarkSource generatedAt="2026-07-01T00:00:00Z" href="/guide/benchmarks#data-sources" />

Charts and summaries render on the server and do not animate or change measurements. The table adds a small keyboard handler for consistent arrow-key scrolling, including mobile WebKit; disclosure remains native. Use nonnegative finite values with one unit per chart; use delta labels for signed changes. A max smaller than an item clips the visual scale and should be avoided. Tables may scroll horizontally inside their own region, never the document.


Code

Block code

<h1 class="block font-6xl tracking:.2em text-center">  Hello, world!</h1>

Inline code

  • js -> const foo = 'bar'
  • ts -> const options: Options = {}
  • css -> body { background: red; }
  • mcss -> text-center

Code lines added and removed

console.log('hewwo') console.log('hello') console.log('goodbye')

Code line highlight

console.log('hewwo')console.log('hello') console.log('goodbye')

Code line focus

console.log('hewwo')console.log('hello') console.log('goodbye')

Code mark words

const foo = 'bar'

Project style recipes

Use DemoConfiguredExample when a preview needs project tokens or managed classes. The same configuration and literal HTML supply the live iframe, visible code and complete generated CSS. Each preview owns its stylesheet and cannot change the surrounding document's theme, component classes or cascade.

A small project vocabulary
p-card reads spacing, r-card reads radius, and fg-brand reads color. Each class retains a reference to its theme variable.
Read the lesson →
One spacing token, two consumers
Both elements have 1.5rem of padding. A change to --spacing-card applies to both consumers.
Read the lesson →
The same card in two modes
The same card in two modes controls
Theme switches the preview document’s light/dark class. The browser resolves the actual generated custom properties.
Read the lesson →
A component with native interaction states
Hover or focus the button to inspect its shared states.
Read the lesson →
A local utility overrides the component
The same component is used twice. With the base layer order loaded, the normal padding utility wins in the second card.
Read the lesson →
A field that follows its content
The textarea uses native field-sizing. Minimum and maximum heights bound the enhancement; unsupported browsers retain a usable field.
Read the lesson →
Selection with a native selector
Check the option with a pointer or the Space key. :has(:checked) adds a border cue; the native checkbox carries the state.
Read the lesson →
<ProjectStyleExample name="tokens" /><ProjectStyleExample name="modes" /><ProjectStyleExample name="components" /><ProjectStyleExample name="layers" />

For a new lesson, supply its actual configuration and complete HTML:

<DemoConfiguredExample name="project-spacing" title="A project spacing token"  source="@theme { --spacing-card: 1.5rem; }"  html={'<article class="p-card">Collection details</article>'}  caption="p-card references --spacing-card." />

theme adds a real document-class switch; define explicit .light and .dark branches with @mode in the configuration when teaching that behavior. The default has no controls. code={false} is for a gallery specimen whose usage link leads to the complete source. These are server components; only the existing iframe controls hydrate. Use trusted site-authored HTML with literal classes. Content-sized previews suit ordinary document flow; use DemoViewport directly for bounded scrolling, fixed positioning or viewport geometry.

shadow places the HTML and generated utility rules inside a real open shadow root. Foundation variables inherit from the iframe document. This variant previews styling; it does not load a framework or test runtime lifecycle. Keep that distinction in the caption and document runtime setup in the linked lesson.

HTML
<button type="button" class="px-md py-sm r-sm bg-blue fg-white">Hello Lit</button>
A shadow-root specimen
Generated utility CSS in an open shadow root; no framework runs in this preview.
Generated CSS
@layer theme {  :root,  :host {    --spacing-md: 1rem;    --spacing-sm: .75rem;    --radius-sm: .25rem;    --color-blue: var(--color-blue-60);    --color-blue-60: oklch(51.83% .2687 266.1);    --color-blue-50: oklch(58.22% .2279 263.9)  }  @media (prefers-color-scheme:light) {    :root {      --color-blue: var(--color-blue-60)    }  }  @media (prefers-color-scheme:light) {    :host {      --color-blue: var(--color-blue-60)    }  }  @media (prefers-color-scheme:dark) {    :root {      --color-blue: var(--color-blue-50)    }  }  @media (prefers-color-scheme:dark) {    :host {      --color-blue: var(--color-blue-50)    }  }}@layer utilities {  .r-sm {    border-radius: var(--radius-sm)  }  .py-sm {    padding-block: var(--spacing-sm)  }  .px-md {    padding-inline: var(--spacing-md)  }  .bg-blue {    background-color: var(--color-blue)  }  .fg-white {    color: oklch(100% 0 none)  }}
<DemoConfiguredExample name="shadow-button" title="Shadow-root styling"  source="" html={'<button class="px-md py-sm bg-blue fg-white">Hello</button>'}  caption="Generated CSS inside a shadow root." shadow />

Used by Lit installation. The same default preview also supports the rendered markup in React and Vue.

For formal rules that need code without a live preview, ConfiguredExample accepts the same source and literal html (or its existing classes shorthand). It uses the same native-property support as the preview and includes complete generated CSS.

Platform behavior

Use DemoFeatureSupport beside a native CSS example to report the current browser's syntax support. It never changes the specimen's styles. Keep a usable fallback in the example; a positive result is not a visual conformance guarantee. The support label review compares the Guide's original guidance with the previous and adopted live labels.

(field-sizing: content)Checking this browser…

selector(:has(:checked))Checking this browser…

<DemoFeatureSupport condition="(field-sizing: content)" /><ProjectStyleExample name="nativeField" />

The field and checkbox recipes above are used in Compatibility. The status starts with a neutral checking label during server rendering, then reports the browser's actual CSS.supports() result. Supported and unsupported states retain the same layout and textual explanation.

DemoViewTransition provides two isolated interactive examples. The default is view selection; the article variant demonstrates matching snapshot names and focus restoration. Both use the existing iframe component and shared controls.

A change of view
Choose a view. The panel and heading use named snapshots; unsupported browsers and reduced motion use the same immediate update.
From collection to article
Open an article, then return to its card. Each image and title keeps a unique snapshot name. Scroll inside the preview when needed.
<DemoViewTransition /><DemoViewTransition example="articles" />

Each preview owns a document and a bounded scroll area. It cannot capture the documentation page's root snapshot. The scene uses unique element names, skips animations for reduced motion and retains an immediate update when the API is unavailable. These are scenario recipes, not application navigation components. See View Transitions for framework-neutral markup, generated CSS and platform constraints.

Typography and motion recipes

Type hierarchy

View guide ↗
A readable type hierarchy
Size, weight and color establish hierarchy. The full body copy stays visible at every preview width.

Size and treatment

View guide ↗
One size, two type treatments
Both specimens have the same font size and content. font-3xl inherits the parent’s leading and tracking; text-3xl sets all three properties.

Finite entrances

View guide ↗
Two finite entrances
Two finite entrances controls
Both animations run once and start paused. Play and Replay control the native timelines. Reduced motion shows the content immediately without animation.

State transition

View guide ↗
A transition needs two states
The checkbox changes translateX from 0 to 96px. The 300ms transition starts after a 150ms delay. Reduced motion changes the state immediately; print keeps the initial position.

Dialog entrance

View guide ↗
Motion follows a real action
The dialog enters once on opening. Escape or Close details returns focus to its trigger. Reduced motion opens it immediately. Its modal boundary stays inside this preview.

Use FoundationTypography for a complete reading hierarchy and FoundationTypeComparison to compare raw size with a full text treatment. Both keep all content visible and preserve the same font resources. Computed size, leading and tracking are reported outside the measured text.

<FoundationTypography /><FoundationTypeComparison /><FoundationMotion /><FoundationTransition /><FoundationDialog />

FoundationMotion starts paused and retains finite native timelines for replay. Its authored media conditions still apply: reduced motion shows the final content without an animation. FoundationTransition uses a native checkbox with explicit endpoints and removes both duration and delay under reduced motion. FoundationDialog opens a real modal inside a bounded iframe; its entrance runs once, and closing remains immediate. Keep focus, names and descriptions in the HTML.


Color and elevation recipes

Preset palette
Select a swatch to copy its variable.

blue

0
5
10
20
30
40
50
60
70
80
90
95
100

violet

0
5
10
20
30
40
50
60
70
80
90
95
100
Choose a swatch to copy its CSS variable reference. Each swatch shows the fixed preset value in both themes.

Color roles

View guide ↗
One composition, two modes
Light
Dark
Both documents use identical classes. The active mode supplies the surface, line and text values.

Surface hierarchy

View guide ↗
Surface hierarchy
Light
Dark
Color separates these surfaces. This example adds no shadow.

Line roles

View guide ↗
Visible boundaries
Light
Dark
The line role selects a color. Width and style still need an explicit declaration.

Text roles

View guide ↗
Readable hierarchy
Light
Dark
The archive action is natively disabled. Inverse text is paired with its inverse surface.
A mode-aware hue
Light
Dark
Hue aliases adapt their palette step to the mode. They do not choose a matching text color automatically.
Foreground color by role
Light
Dark
text-blue uses the foreground-oriented alias. Check the actual foreground and surface together.

Quiet elevation

View guide ↗
Quiet separation
Light
Dark
shadow-sm uses the same offsets across these modes, with different edge and shadow colors.

Interactive elevation

View guide ↗
Depth follows interaction
Light
Depth follows interaction · light controls
Dark
Depth follows interaction · dark controls
A native link supports pointer and keyboard focus. The focus outline remains visible; printing removes the shadow.

DemoThemeComparison renders the same trusted HTML in two independent preview documents. Both use real mode variables. Content sizing keeps normal-flow content visible; use DemoViewport directly for viewport-dependent or scroll-boundary lessons.

<DemoThemeComparison  name="surface-card"  title="A shared surface"  html='<article class="p-md surface-raised text-body">Notes</article>'/>

DemoPalette reads fixed preset colors and copies CSS variable references. Pass families={['blue', 'violet']} for a focused set. DemoCopyButton accepts value, label, an optional icon, native button attributes and children. Text controls use a copy icon by default; color chips pass icon={null}. Its status confirms successful writes or explains when the browser declines clipboard access.

The palette review compares the original Guide palette, the earlier shared gallery and the adopted token gallery. The Guide's existing copyable palette remains in place.

<DemoCopyButton value="var(--color-blue-60)" label="Copy blue token">  Copy token</DemoCopyButton>

The copy control review compares the Guide swatch, earlier button and adopted treatment.

DemoTokenTable groups each token with its utilities, leaving a readable column for its role or value. Rows may include a decorative preview. Keep inventory tables outside the measured scene and derive their values from preset data.

Token / classRole
--shadow-sm
shadow-sm
A small raised surface.
<DemoTokenTable rows={[  { token: '--shadow-sm', utilities: ['shadow-sm'],    description: 'A small raised surface.' }]} />

The palette does not choose foreground/background pairs. In color tables, direct variable previews are inventories; practical recipes use complete literal utilities. Shadow examples supply enough canvas space for paint and preserve the focus outline.


Foundation recipes

Use practical compositions when teaching layout decisions. These shared specimens appear in the Guide; their links identify the owning lesson. Native links and checkboxes remain usable inside page previews.

Viewport typography

View guide ↗
Viewport typography
Viewport typography controls
Resize the actual iframe across md. The surrounding document keeps its own viewport.

Container grid

View guide ↗
One card, two available widths
Asset library

Space to compose

A single column stays readable in a sidebar. A wider container gives the image its own track.

Container grid controls
Measuring container…
The nearest inline-size container controls the descendant grid. Its md token is separate from the viewport md token.

Container media object

View guide ↗
A component follows its container
Collection / 024

Field notes

A small archive of places, textures and quiet details from the trail.

12 imagesUpdated today
Media object controls
Measuring container…
Below md the media stacks. At md it keeps a 36x width beside flexible text.

Fluid wrapper and measured object

View guide ↗
Fluid space, measured object
w:100% · max-w-sm
FN
Field notes

Measured avatar. Flexible content.

One axis or both

View guide ↗
Choose one axis or both
width:3.5rem height:3.5rem
FN
w:100% h:3.5rem
Collection

Shrinkable content

View guide ↗
Keep long content within its cap
FN
Project archive

field-notes-autumn-collection-final-v03.fig

Shrinkable row controls
Measuring container…
The row stops at sm. The flexible text region can shrink below its content width.

Radius scale

View guide ↗
One scale, related surfaces
r-sm
Control
r-lg
Panel
r-2xl
Feature

Shape shortcuts

View guide ↗
Content-sized pill and width-led circle
w:48px round
These links share a destination. Their shape is independent of their native navigation behavior.
Workspace layout
Workspace layout controls
Adjust the iframe viewport. Scroll inside the preview to see all content.
Responsive asset gallery
Responsive asset gallery controls
Adjust the iframe viewport. Scroll inside the preview to see all content.
<FoundationBreakpoint /><FoundationContainerGrid /><FoundationMedia /><FoundationSizing /><FoundationAxes /><FoundationShrink /><FoundationRadius /><FoundationShapes />

DemoContainer adjusts a real wrapper while the page viewport stays fixed. Children explicitly provide their query boundary and responsive descendants. Its framed specimen bed keeps the width control and live measurement outside that query layout. The native range supports keyboard and touch; Fit restores the available width. Widths larger than the canvas stay reachable through horizontal scrolling inside the demo. The container review compares the original Guide resize zone, earlier control and adopted frame.

<Demo title="Container query" padding="none">  <DemoContainer title="Card">    <section className="container">      <article className="grid-cols:1 grid-cols:2@container((width>=28rem))">        <div>Media</div><div>Content</div>      </article>    </section>  </DemoContainer></Demo>

A query container introduces inline-size containment. Place it outside the responsive subject and let the parent establish its available width. Measurement and controls stay outside that layout. A wrapper capped by max-width can remain narrower than the adjustable region; label which boundary is being measured.

DemoPageViewport reuses the viewport controls for a trusted, same-origin site example page. It adjusts the actual iframe viewport, synchronizes the theme and keeps long page content scrollable. Use this for viewport breakpoints; use DemoContainer for component size queries. Do not use a transformed canvas to simulate either condition.

<DemoPageViewport  src="/examples/layout-system"  title="Workspace layout"  height={540}/>

The complete workspace and gallery recipes teach layout structure and responsive design. Their reduced HTML shows the same column counts, spans and thresholds as the preview.


Recipes

Choose a category, then expand a recipe to try the same scene used in Reference. Each entry links to its complete explanation and framework-neutral source. Native disclosure controls support keyboard navigation and keep the catalog compact; the complete specimens remain in the server-rendered page.

Each scene supplies the environment its property needs: a formatting context for floats, a real viewport for fixed positioning, or overflow for scrolling.

Flow4 recipes

Clear the right boundaryclear
Read the example and source ↗
Clearing right floats
The blue block clears the right float. Its text still wraps around the taller left float, whose box overlaps the blue background.
Follow a native floating shapeshape-outside
Read the example and source ↗
Wrap text around a circle
The artwork and float box are explicit. Shape-outside changes the space available to adjacent inline content without clipping the artwork.
Reserve a shape’s surrounding spaceshape-margin
Read the example and source ↗
Reserve room for a larger shape margin
The same painted circle and ordinary margins are preserved. Shape-margin expands the wrap boundary within the float’s margin box.
Extract wrapping from image alphashape-image-threshold
Read the example and source ↗
Set the alpha threshold
Image paint is unchanged. The browser extracts the wrap shape from pixels whose alpha exceeds the threshold; a basic shape uses its own geometry.

Flexbox & grid11 recipes

Arrange on two axesalign-items
Read the example and source ↗
Align items on the cross axis
Compare the blue item with the violet sibling. Automatic sizes can stretch; explicit sizes keep their dimensions.
Keep fixed and flexible regionsflex
Read the example and source ↗
Let an item fill remaining space
The blue item receives the demonstrated shorthand. The measurements show the actual border boxes after flex sizing.
Measure distributed free spaceflex-grow
Read the example and source ↗
Let an item grow
Grow factors divide the extra space, not the final widths. Both items keep their authored bases and padding.
Preserve the source sequenceorder
Read the example and source ↗
Keep source order meaningful
Focus Source 1, then press Tab. The browser follows the source sequence; CSS order changes only these items’ visual positions.
Separate track and item alignmentplace-content
Read the example and source ↗
Use separate axis values
The fixed track group moves within the larger grid container. Its column widths, row heights and minimum gaps stay unchanged.
Stretch automatic dimensionsalign-items
Read the example and source ↗
Stretch automatic-sized children
Compare the blue item with the violet sibling. Automatic sizes can stretch; explicit sizes keep their dimensions.
Keep overflowing content reachablejustify-content
Read the example and source ↗
Keep overflowing content reachable
The overflow is real and scrollable. Safe centering preserves access to the start; unsafe centering loses the portion before the scrollport.
Distinguish explicit and implicit tracksgrid-auto-columns
Read the example and source ↗
Size implicit columns
The violet first column is explicit. The blue column and its following sibling use the implicit-column size.
Pack cells without reordering focusgrid-auto-flow
Read the example and source ↗
Fill gaps densely
Compare the position of 03, then focus 01 and press Tab. Visual packing changes; source-order keyboard traversal does not.
Map responsive named regionsgrid-template-areas
Read the example and source ↗
Apply conditionally
grid-template-areas: Apply conditionally controls
Header, Nav and Content keep their area names. The parent supplies both the region map and its track sizes.
Compare flexible track minimumsgrid-template-columns
Read the example and source ↗
Control a track’s minimum
The content stays 192px wide in both examples. The blue cell clips excess content when its track is allowed to shrink.

Sizing & spacing6 recipes

Expose the box modelpadding
Read the example and source ↗
Add padding on every side
Blue surrounds the neutral content. The content inset reports physical left and top padding; the padding value lists the physical sides.
Measure intrinsic content widthswidth
Read the example and source ↗
Use intrinsic width keywords
The dashed outline is the authored containing block. Read the actual blue border-box width alongside its parent.
Release an automatic flex minimummin-width
Read the example and source ↗
Allow flexible children to shrink
Compare the preferred width with its actual lower bound. The blue measurement includes padding but excludes its decorative outline.
Follow logical padding directionspadding
Read the example and source ↗
Set inline or block padding
Blue surrounds the neutral content. The content inset reports physical left and top padding; the padding value lists the physical sides.
Distinguish ratio from fixed dimensionsaspect-ratio
Read the example and source ↗
Pair with one explicit axis
The ratio is a preferred constraint. An automatic dimension can follow it; two definite dimensions take precedence.
Observe constrained native resizingresize
Read the example and source ↗
Restrict resizing to one axis
Drag the native resize handle where supported. The readout measures the real control box as it changes. Editing and scrolling remain available when handles are absent.

Position & scrolling5 recipes

Keep context in viewposition
Read the example and source ↗
Positioning elements as sticky
Focus the list and scroll with the arrow keys. The blue row sticks to its top edge after the first row scrolls away.
Compare local paint orderz-index
Read the example and source ↗
Prefer local stacking contexts
Z-index values are compared within their own stacking context. Raising the child to 99 cannot lift its parent above sibling 1.
Separate clipping from scrollingoverflow
Read the example and source ↗
Clip without scrolling
The buttons call the same native scroll API as the hidden example. Clip remains at its original scroll position.
Reserve a viewing insetscroll-padding
Read the example and source ↗
Reserve space for fixed headers
The scroll container owns the viewing inset. Choose an interior target to see its alignment without reaching the track’s boundary.
Observe native scroll chainingoverscroll-behavior
Read the example and source ↗
Contain nested scrolling
Send the inner list to its bottom edge, then continue scrolling over it. Compare the outer y value; the iframe keeps both experiments separate from the document.

Typography17 recipes

Give content a rhythmtext-wrap
Read the example and source ↗
Balance short headings
The text and line width are identical across the comparison. Exact breaks depend on the browser’s wrapping algorithm and loaded font.
Preserve an inherited resetfont-style
Read the example and source ↗
Reset font style
The blue child resets its inherited slant. The surrounding words keep their italic style.
Measure actual digit advancesfont-variant-numeric
Read the example and source ↗
Align tabular numbers
The selected font must support the feature. Compare actual digits as well as computed values; equal digit counts make advances comparable.
Compare inherited line heightsline-height
Read the example and source ↗
Use explicit values
The readout is the computed line height, not glyph height. Mixed sizes, inline objects and inherited values can affect the final line box.
Align against a native text baselinevertical-align
Read the example and source ↗
Align icons with text
These are actual inline boxes and table cells. The annotations are outside the formatting context and cannot become extra inline content.
Preserve meaningful whitespacewhite-space
Read the example and source ↗
Preserve spaces and wrapping
The specimens preserve the exact spaces and line breaks in the adjacent source. Annotation text stays outside that context.
Separate wrapping from intrinsic widthoverflow-wrap
Read the example and source ↗
Allow breaks anywhere
Compare the authored constraints and actual box sizes. Emergency breaks and intrinsic width are separate parts of text layout.
Keep the full description reachableline-clamp
Read the example and source ↗
Keep important content accessible
Clamping limits the visible lines. Preserve the complete source and provide another reading path whenever the omitted text is needed.
Follow native column progressionwriting-mode
Read the example and source ↗
Use vertical right-to-left flow
Writing mode sets line orientation and block progression. The authored dimensions make the column direction visible.
Remove decoration at its origintext-decoration
Read the example and source ↗
Remove decoration
The readings describe the element that originates the decoration. A descendant can have no decoration of its own while the ancestor’s line still paints through its inline text.
Separate glyph fill from foregroundtext-fill-color
Read the example and source ↗
Use the current color
Glyph fill is independent of the foreground color. The plain surface adds no fill, stroke or background to the subject.
Compare paint without resizing texttext-stroke-width
Read the example and source ↗
Set text stroke width
Compare the same glyphs at the same font size. The width changes the painted edge; box measurements expose the unchanged layout geometry.
Preserve running counter scopecounter-set
Read the example and source ↗
Set a counter on one item
The readout follows the element that sets the counter. Reset, increment and set are separate operations; following elements continue from the resulting value.
Compare native hanging markerslist-style-position
Read the example and source ↗
Place markers inside the content box
Identical content and width reveal the wrapped-line alignment. Marker position is independent of the surrounding label and property readout.
Keep meaning in the link textcontent
Read the example and source ↗
Add indicators for external links
The readout observes the actual ::after pseudo-element. The link remains a native, keyboard-accessible anchor with meaningful text in the HTML.
Preserve native inline fragmentsbox-decoration-break
Read the example and source ↗
Clone
One inline element creates real line fragments. The readings expose standard and WebKit property support; the container controls wrapping.
Keep selection boundaries explicituser-select
Read the example and source ↗
Select a whole value
Use the platform’s text-selection gesture on the authored content. Selection rules do not disable native control actions or protect text from copying.

Color & media9 recipes

Separate paint from positioningbackground-origin
Read the example and source ↗
Choose the background positioning area
Origin determines the image’s positioning area. Clipping stays separately authored, so positioning and painting boundaries remain distinct.
Preserve focused background changesbackground
Read the example and source ↗
Prefer focused utilities for simple changes
Each specimen supplies its own image and geometry. Read the longhands separately to see what the shorthand changes or resets.
Compare image fit and cropbackground-size
Read the example and source ↗
Cover a frame
The readout reports the computed size, including keywords. The artwork’s visible edges expose the actual fit, crop or distortion.
Observe native background attachmentbackground-attachment
Read the example and source ↗
Attach to scrollable content
Scroll both the inner panel and this preview page. Fixed attachment refers to the iframe viewport; local refers to the scrollable content. Actual paint support can vary by platform.
Keep the image box independent of fitobject-fit
Read the example and source ↗
Cover a fixed frame
The source is 320 × 200. The measured box belongs to the image element; fitting changes the content inside it.
Place content within its cropobject-position
Read the example and source ↗
Use precise positions
The 240 × 100 image box contains a 240 × 150 cover image. Positioning changes its crop without moving the element.
Compare theme and palette paintfill
Read the example and source ↗
Use theme colors
fill: Use theme colors controls
The shapes and paint are explicitly authored. Fill is inherited independently of stroke; controls retain their native accessible names.
Distinguish SVG units from screen paintstroke-width
Read the example and source ↗
Pair width with stroke color
The 24 × 24 viewBox scales into a 96 × 96 viewport. Computed width and final painted thickness are different measurements.
Compare SVG transform reference boxestransform-box
Read the example and source ↗
Choose the transform reference box
The complete HTML or SVG preserves source geometry. Reference boxes control percentages and pivots; client bounds use getBoundingClientRect and do not include an SVG stroke’s full paint.

Edges & effects12 recipes

Isolate an external backdropisolation
Read the example and source ↗
Create a stacking context
Both blue backgrounds sit outside the tested section. An isolated section prevents its purple child from blending with that external backdrop.
Show the layers beneathbackdrop-filter
Read the example and source ↗
Blur content behind an element
The complete composition supplies the backdrop and panel. Filtering changes pixels behind the panel, while its own text remains sharp.
Follow physical and logical edgesborder
Read the example and source ↗
Set one side or one axis
Border readings use CSS shorthand order. The measured box includes its padding and borders.
Separate curves from clippingborder-radius
Read the example and source ↗
Use a radius token
Compare the painted corners with the measured layout box. Radius, aspect ratio and overflow are separate properties.
Inspect mode-specific shadow layersbox-shadow
Read the example and source ↗
Customize mode-specific tokens
box-shadow: Customize mode-specific tokens controls
These are the browser’s actual shadow layers. The measured box excludes their paint; theme tokens may resolve differently in each mode.
Compare native shared table edgesborder-collapse
Read the example and source ↗
Match border spacing to the mode
Cell borders and spacing are explicitly authored. Compare the actual shared seams as well as the computed table properties.
Separate source slices from border paintborder-image-slice
Read the example and source ↗
Slice the source image
The 96 × 96 source uses 24-unit corners. Slice boundaries belong to the source; painted widths belong to the destination border.
Fit actual patterned edge tilesborder-image-repeat
Read the example and source ↗
Round repeated edge slices
The first repeat value controls top and bottom edges; the second controls left and right. The source pattern makes individual tiles visible.
Follow transparent source silhouettesfilter
Read the example and source ↗
Use drop shadow for transparent images
The source and its dimensions are explicit. Filters change the painted group; the measured layout box stays unchanged.
Separate clipped paint from layoutclip-path
Read the example and source ↗
Clip with an inset
The outer outline marks the original box. Clipping changes paint and hit testing without changing layout dimensions.
Fade a real scrollable regionmask-image
Read the example and source ↗
Fade overflowing media
The mask changes painted opacity. The CSS box keeps its dimensions and hit area; annotations remain outside the mask.
Bound blending with an explicit groupmix-blend-mode
Read the example and source ↗
Blend an element with its backdrop
The explicitly isolated group contains both backdrops. Foreground geometry and source colors are identical in each comparison.

Motion13 recipes

Choose deliberate snap stopsscroll-snap-stop
Read the example and source ↗
Use sparingly
Reset, then Advance by the same immediate 600px request. Always stops a directional scroll at the next eligible point; normal allows it to pass.
Make time visibleanimation-direction
Read the example and source ↗
Play alternately
animation-direction: Play alternately controls
Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.
Keep layout and transform bounds distincttransform
Read the example and source ↗
Move an element
transform: Move an element controls
The authored guide keeps the original layout slot visible. Client bounds follow the transformed element’s getBoundingClientRect, not its unchanged layout dimensions.
Anchor a scale to its pivottransform-origin
Read the example and source ↗
Set the pivot point
The reference dimensions, pivot and transform are authored together. Markers stay outside the transformed element; the guides reveal displacement while client bounds report transformed width and height.
Expose native 3D flatteningtransform-style
Read the example and source ↗
Flatten nested transforms
The parent, front layer and perspective form a real 3D context. Compare the child’s geometry: grouping effects can flatten it even when the computed keyword remains preserve-3d.
Select which changes interpolatetransition-property
Read the example and source ↗
Limit what can animate
transition-property: Limit what can animate controls
Each control changes the same authored endpoints. Only properties in the selected list interpolate; unrelated changes remain immediate.
Compare travel distance and durationtransition-duration
Read the example and source ↗
Match duration to distance
transition-duration: Match duration to distance controls
The control, travel distance and easing stay explicit. Duration is the interpolation interval, independent of any start delay.
Stagger real sibling transitionstransition-delay
Read the example and source ↗
Stagger sibling elements
transition-delay: Stagger sibling elements controls
The visible control changes the endpoint before the layer starts moving. Each changing child owns its duration and delay; they are not inherited.
Compare progress through timetransition-timing-function
Read the example and source ↗
Choose an easing curve
transition-timing-function: Choose an easing curve controls
The native transition keeps its authored duration and endpoints. Compare how the curve distributes progress, or how steps advances at discrete boundaries.
Separate delay from active progressanimation-delay
Read the example and source ↗
Delay animation start
animation-delay: Delay animation start controls
Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.
Retain native start and end statesanimation-fill-mode
Read the example and source ↗
Apply both before and after states
animation-fill-mode: Apply both before and after states controls
Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.
End within a fractional cycleanimation-iteration-count
Read the example and source ↗
Specify a number of iterations
animation-iteration-count: Specify a number of iterations controls
Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.
Apply easing at the keyframe intervalanimation-timing-function
Read the example and source ↗
Match easing to intent
animation-timing-function: Match easing to intent controls
Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.

Interaction10 recipes

Keep controls accessiblescreen-readers
Read the example and source ↗
Label icon-only controls
Visible annotations explain the actual accessible name or description. Use Tab to reach the visible native control; its hidden label is not a separate focus target.
Show actual keyboard focusoutline
Read the example and source ↗
Keep outlines for focus
Outlines paint around the box without adding layout space. Use the actual keyboard focus state to inspect conditional treatments.
Preserve interaction under opacityopacity
Read the example and source ↗
Fade an entire element
Opacity changes the entire painted group. Native controls keep their names and keyboard behavior; color alpha changes only that color.
Prepare and release an actual browser hintwill-change
Read the example and source ↗
Reset when the hint is no longer useful
will-change: Reset when the hint is no longer useful controls
The readout observes the actual hint. Native controls remain visible and operable; this specimen does not measure speed or prove compositing-layer promotion.
Pause decoration while editinganimation-play-state
Read the example and source ↗
Pause nonessential motion
animation-play-state: Pause nonessential motion controls
The native checkbox and authored selectors control the child’s CSS play state. Pausing preserves its time. Reduced motion keeps it paused; print removes the animation.
Keep the platform control intactaccent-color
Read the example and source ↗
Set the accent color
Use the actual checkbox, radio group and range. The browser and platform decide how a requested accent is painted; the controls retain their native keyboard behavior.
Restyle a native selectappearance
Read the example and source ↗
Remove default styling
The full authored select and its options remain native. Change its value with the platform picker or keyboard; appearance changes paint without replacing the accessible label.
Separate pointer targeting from focuspointer-events
Read the example and source ↗
Let clicks pass through an overlay
Pointer hit testing and keyboard access are independent. Use the real checkbox or reset button to verify the action; transparent overlays keep their authored geometry.
Distinguish touch gestures from scrollingtouch-action
Read the example and source ↗
Disable browser gestures on a custom surface
Swipe on a touch device to test native panning. Keyboard scrolling remains available. The rules allow or restrict browser gestures; no custom drawing or drag handler is supplied.
Observe actual native drag startsuser-drag
Read the example and source ↗
Prevent dragging media
Try a native pointer drag in a supporting browser. The event readout observes actual drag starts; vendor property support and touch behavior depend on the platform.

DemoCatalog groups named recipes into native disclosures. Each entry supplies its preview and a link to the complete lesson. DemoIndex provides the same categorized link treatment for page sections. Both render on the server and need no custom keyboard handlers. The catalog review shows the original Guide index, earlier shared disclosure, adopted version and a real Reference scene.

import DemoCatalog from '~/site/components/demo/DemoCatalog'<DemoCatalog groups={[{  id: 'recipe-flow', title: 'Document flow', entries: [{    id: 'clear-right', title: 'Clear the right boundary', label: 'clear',    href: '/reference/clear#clearing-right-floats',    children: <DemoExample page="clear" section="clearing-right-floats" />,  }],}]} />

Keep group IDs unique within the page. The disclosure controls sit outside the preview; they never become flex items, grid cells or part of the demonstrated text flow. Collapsed recipes retain their source in the page, while native lazy iframe loading defers offscreen previews. This pattern is for browsing many independent examples; keep the primary example in an individual lesson directly visible.

Authoring

Import site primitives from ~/site/components/demo. They are also available in MDX. Static primitives render on the server; measurements, playback and viewport controls add only the client behavior they need. In TSX, import DemoThemeComparison, DemoPalette, DemoTokenTable and foundation recipes directly from their matching files under site/components/demo/; these server helpers are registered separately from the client-compatible barrel.

Demo

Interface: title, description, caption, controls, background, padding

className and style apply to the canvas. frameClassName styles the outer frame.

DemoSurface

Interface: elevation="none" | "raised", native div props

A bordered surface with a compact radius; no implicit layout, padding, clipping or shadow. The raised option adds paint-only depth.

DemoItem

Interface: tone, variant, native div props

Paint only. Add geometry and layout explicitly. The default tone is neutral; blue and violet are explicit teaching roles.

DemoComparison

Interface: Native div props

Responsive comparison columns; each child is one specimen.

DemoText, DemoMedia, DemoSwatch

Interface: Text accepts variant="body" | "lead" | "caption" plus native paragraph props; media accepts SVG props or src and alt; swatches require label and accept optional value

Reusable text, SVG artwork and labeled color samples.

DemoLabel, DemoLegend

Interface: Text; legend items with label and tone

Annotations accompany the subject instead of joining its layout.

DemoMeasure

Interface: label, children

Measures its content wrapper with ResizeObserver; the separate readout updates with width and height. Place it outside the demonstrated parent.

DemoAxes

Interface: inline, block, children

Labels a rightward horizontal axis and downward vertical axis around the example. Use custom labels only when those physical directions still match the scene.

DemoControls

Interface: label, variant="plain" | "segmented", children

A labeled fieldset for native controls.

DemoScrollArea

Interface: Native div props

Focusable region with bounded overflow.

DemoMotion

Interface: children

Explicit play, pause and replay using browser animations.

DemoViewport

Interface: title, document or src, responsive, widthPresets, theme, print, motion, initialTheme, inspect, height, maxWidth, sizing

An isolated iframe; width controls resize the actual viewport.

DemoThemeComparison

Interface: name, title, html, css, caption, height, print

Compiles one trusted specimen into two independently themed, content-sized documents.

DemoPalette

Interface: Optional families

Fixed preset color inventory with native clipboard actions.

DemoCopyButton

Interface: value, label, native button props

Reports the actual clipboard result and retains keyboard focus.

DemoTokenTable

Interface: rows, optional descriptionTitle

Two-column document inventory; long tokens scroll inside the table.

DemoContainer

Interface: title, children, maxWidth

A measured wrapper with keyboard-accessible width controls; children own containment.

DemoPageViewport

Interface: src, title, height

A trusted site example page in a real, scrollable viewport.

Choose the smallest useful frame

background accepts stripes (default), grid, dots, plain, or checkerboard. padding accepts lg (default), md, sm, or none. Use none for an embedded viewport, a full-bleed scene, or a composition with its own padding.

Minimal compositions

Every specimen below is available directly in MDX. The surrounding example owns geometry; these small compositions show where annotations and controls belong.

<DemoSurface className="p-md">  <DemoLabel>Layer</DemoLabel>  <DemoText>Form follows function.</DemoText></DemoSurface><DemoComparison>  <DemoItem tone="neutral" className="p-md">Before</DemoItem>  <DemoItem tone="violet" variant="outline" className="p-md">After</DemoItem></DemoComparison><DemoMedia className="w:100%" /><DemoMedia src="/demo/landscape.svg" alt="Sun above mountains" /><DemoSwatch label="Subject" className="bg-demo-blue" /><DemoAxes>  <DemoMeasure label="Container">    <div className="flex gap-sm">{/* measured layout */}</div>  </DemoMeasure></DemoAxes><DemoLegend items={[{ tone: 'blue', label: 'Subject' }]} /><DemoControls label="Alignment">  <button type="button" className="demo-button">Start</button></DemoControls><DemoScrollArea aria-label="Layers" className="h:10rem">  {/* overflowing content */}</DemoScrollArea><DemoMotion>  <DemoItem className="width:4rem height:4rem animation:rotate|2s|linear|infinite" /></DemoMotion><DemoViewport title="Responsive layout" document={htmlDocument} responsive />

DemoComparison arranges direct children in responsive columns; use a native stacking parent when comparing vertically. DemoScrollArea intentionally establishes overflow. DemoViewport receives a complete HTML document with its own CSS, and supports native events, theme inspection and print preview. Its width control spans 240–1600px by default, so the preset lg breakpoint at 1280px is reachable. Set maxWidth for a wider threshold when needed. Pass only trusted, site-authored documents; the iframe isolates layout and is not a security boundary. Set initialTheme="light" or "dark" to pin a specimen’s initial mode; omit it to follow the surrounding page. Controls become available after the preview is ready. Use the Reference recipes for compiled utility examples.

Named viewport widths

Use widthPresets with responsive to expose meaningful boundaries alongside the range control. The first preset sets the initial iframe width; Fit returns to the available canvas width. Derive breakpoint values from the project’s active theme. Every preset changes the actual viewport, including when it is wider than the phone displaying it.

Viewport: 833px
<DemoViewport  title="A breakpoint comparison"  document={htmlDocument}  responsive  widthPresets={[    { label: 'Below the boundary', width: breakpoint - 1 },    { label: 'Above the boundary', width: breakpoint + 1 },  ]}/>

Keep preset widths inside the range (240px through maxWidth) and use distinct, descriptive labels. Wide frames scroll inside the canvas; do not scale the specimen or rewrite the subject’s styles to imitate a media query. Syntax Tutorial uses the preset sm boundary for padding and conditional hover behavior.

Keep behavior honest

Do not put layout, containment, transforms or clipping on a subject merely to center its label. Those properties can change the behavior being taught. Place controls outside the scene, and use an iframe for viewport-dependent examples.

Size the canvas to the lesson

Use sizing="content" for normal-flow comparisons that stack on small screens. The frame follows its document’s natural height as images load or text wraps, so the reader can see every specimen without a second vertical scroll area.

Keep the default sizing="viewport" for fixed positioning, scrolling, viewport units and height-based conditions. In this mode, height defines the real viewport. Content sizing must not be used when the example’s height depends on the iframe’s own height.

<DemoViewport title="Image fitting" document={comparisonDocument} sizing="content" /><DemoViewport title="Sticky navigation" document={scrollingDocument} height={300} />

Make positioning and paint boundaries explicit

Give a positioning example its containing block in the displayed HTML. Keep labels outside the tested layout; a label inserted into a flex row or text flow changes the lesson. Dashed outlines mark original slots and parent boundaries without adding border dimensions.

Stacking examples need actual overlapping positioned boxes. Show both the child and its parent context when teaching z-index. For isolation, put the comparison backdrop outside the tested element so readers can see which pixels are excluded from blending.

A clipping example should distinguish a scroll container from a clipping boundary. The viewport’s trusted specimen controls support data-scroll-container="element-id" with data-scroll-edge="start" or "end"; they call the element’s native scrollTo() method. Keep these controls outside the clipped element. Use ordinary DOM event listeners in standalone examples.

Expose real scroll geometry

Keep a scrollport’s dimensions, overflow, track direction and snap candidates in the displayed HTML. The scroll recipes decorate that exact structure; they do not supply a missing track or scroll height through shared styles. Keep destination controls and position readings outside the scrollport.

Use nested outer and inner scroll areas to compare chaining. A native position readout makes the result visible even when the platform hides its scrollbars. data-scroll-readout="element-id" reports actual offsets; data-scroll-offset="target-id" with data-scrollport="container-id" and data-scroll-axis="x" or "y" reports the target’s inset from the scrollport edge.

A destination control with data-scroll-to="target-id" uses native scrollIntoView() with the target’s computed snap alignment. It preserves the surrounding document’s scroll position, including in browsers that ignore the nearest-container option. To demonstrate snap stops, use data-scroll-by="container-id" with data-scroll-distance="600": a relative request can stop at an intermediate snap point, while direct endpoint navigation can pass it. Relative snap-stop requests are immediate so their destinations are easy to compare. Smooth-scroll recipes follow the system’s reduced-motion preference.

Measure flex sizing outside the layout

Flex recipes use the complete displayed HTML for parents, items, bases, gaps and constraints. Decorative outlines add no padding, minimum size or flex behavior. Keep axis labels and measurements outside the tested container so they cannot become extra flex items.

In a trusted iframe specimen, data-size-readout="element-id" reports the actual border-box size to one decimal place. A resize observer follows each measured element, including intrinsic sizes that change after a font loads. data-layout-axis="container-id" describes the computed main axis as inline or block, with reversal when applicable. The responsive iframe changes real media-query conditions.

Distinguish a starting basis from the final size. Grow factors distribute positive free space; shrink factors are weighted by the inner flex basis. Put a padded label inside a measured item when the lesson needs a simple outer-size ratio. For direction and order examples, native buttons with tabindex="0" expose the source focus sequence without a custom keyboard handler or positive tab indices.

Distinguish alignment from distribution

Alignment recipes use the same layout paint as flex sizing examples. Author complete parents, tracks, items, gaps and automatic-size constraints in the displayed HTML. The shared paint adds outlines and tone without supplying any of those prerequisites. Name each comparison and keep its labels and readings outside the tested container.

Use data-alignment-axis="container-id" with data-axis-kind="main", "cross" or "both" to describe the relevant logical axes from the computed layout. In Grid, main maps to inline and cross maps to block; in Flexbox they follow the current flex direction. data-style-readout="element-id" with data-style-property="property-name" reports the native computed value, including the resolved grid columns.

data-position-readout="item-id" with data-position-origin="container-id" reports the item’s border-box offset from the container’s inner top-left corner. These are physical visible offsets, not a grid-area origin or unscrolled content coordinates. Negative values make unsafe alignment and actual scrolling visible. Pair offsets with dimensions, and explain which element or track is being aligned.

Demonstrate stretching with an automatic-sized item and an explicitly sized sibling. For safe alignment, compare content that fits with actual overflowing content; make the scrollport focusable and give it an accessible name. Preserve the native overflow so readers can inspect which edges remain reachable.

Expose grid tracks and placement

The Grid recipes render the complete authored parent and children. Define explicit tracks, implicit sizing, flow, gaps and item placement in that HTML. The shared frame adds paint and external readings; it must not create tracks, supply missing items or establish Grid on an incomplete parent.

Use data-style-readout for grid-template-columns, grid-template-rows and grid-auto-flow, alongside the existing size and position readouts. The browser reports resolved track sizes, including implicit tracks. These readings do not distinguish explicit from implicit tracks on their own: explain that boundary in the example and name the relevant items. Line numbers count boundaries, so three explicit tracks have four lines.

Add data-round-pixels to a style readout when fractional pixel values would overwhelm the annotation. It rounds displayed pixel lengths to one decimal place and retains the full computed value in the output’s title. The measured layout is unchanged. When the canvas already contains its property readings, use an empty inspect list to omit duplicate toolbar values.

For dense packing, use spans that leave a real hole and later items small enough to fill it. Show source-order focus with native controls. For fractional tracks, make the available space definite when the lesson requires measured proportions. Keep track minimums separate from the content’s overflow treatment, and describe any deliberate clipping. Named-area examples must author both the area map and the track sizes; resizing changes actual iframe media queries.

Show constraints and content

Sizing recipes render the complete displayed HTML, including the containing block, preferred dimensions, minimums, maximums and actual content. Measure the parent separately from the blue subject so a percentage has a visible reference. Give viewport-height examples a bounded iframe; a frame that grows with its content cannot demonstrate its own height units reliably. Enable viewport width controls for fluid wrappers even when there is no breakpoint.

Use real words for intrinsic sizing and actual media with known source dimensions for ratio and fitting examples. Keep the same content and overflow policy in a comparison. A scrollable overflow value can remove an automatic Flex minimum; use non-scrollable clipping when the lesson needs to isolate the effect of a zero minimum. A maximum does not imply growth or clipping, and matching bounds do not guarantee a square.

Spacing recipes keep labels and readings outside the tested layout. The neutral child exposes the content box inside blue padding; an outline marks the parent without adding a border. Compare content dimensions and physical insets using the existing size and position readouts. Author flow-root, Grid or Flex explicitly when required, and retain normal margin collapse when that is the lesson. Show inline/block behavior with a real writing-mode or direction change. Reserve space before external readings when a fixed-height specimen deliberately exposes visible overflow; keep that space outside the measured box.

Preserve type, glyphs and inheritance

Typography recipes render the authored text, nesting, inline boxes and complete tables. Keep font size, weight, line height, spacing and alignment in the displayed HTML. Shared specimen paint adds a subtle outline and tone without changing those properties. Comparison names and computed readings sit outside the text context; they do not become extra line content or inherit the tested tracking.

Use the same words and reading width when comparing treatments. A computed line height is not a glyph height, and a family list is only a requested stack. For numeric features, measure actual glyph runs with data-size-readout and verify that the selected font supports the requested alternate. Use a proportional face for tabular-digit comparisons; a monospace default would hide the change.

data-font-status="Family name" reports the matching FontFaceSet entry as loaded, loading or unavailable. It does not infer success from font-family, claim that every character uses that face, or substitute a local font for a hosted resource. Whole-document specimens retain their stylesheet links and apply their authored body classes to the actual iframe body.

For optional platform properties, data-empty-value="Not exposed" supplies a clear label when the computed value is empty. An empty inspect list suppresses property inspection and does not create a toolbar on its own.

Let ordinary text previews grow with their content. Enable a real viewport control for fluid type formulas, even without a media query. Keep reset examples nested and baseline examples inline; a block placeholder cannot demonstrate vertical-align. Platform-specific rendering hints need visible support limitations, not a simulated pixel effect.

Preserve text flow and reading paths

Text-flow recipes use the same type surfaces and external readings. Keep lang, dir, exact whitespace, nested writing contexts and complete overflow prerequisites in the displayed HTML. Never replace CJK or RTL content with an English placeholder, or insert visible annotation text into a whitespace-sensitive specimen.

Compare identical text and constraints. Use a genuine min-content box to demonstrate intrinsic wrapping differences, and an authored, named scroll region for intentional overflow. Native range geometry belongs in validation; it must not override line breaks or substitute synthetic text.

A truncation example needs a complete visible reading path when the hidden information matters. Use native disclosure controls with a descriptive summary, keep essential instructions visible, and verify keyboard focus and expansion. A tooltip alone is insufficient.

Use data-style-pseudo="::first-letter" with a style readout when the taught property applies to a pseudo-element. The same measurement component reads that native computed style. Do not infer a rendering-quality or performance improvement from an accepted hint.

Isolate glyph paint

Use the authored-text recipe with appearance: 'plain' for decoration, fill, shadow and stroke. It keeps the neutral surface and external labels while leaving the subject’s background and outline untouched. Read the actual longhands alongside optional box measurements; a paint change does not imply a new font size or layout box.

typeSpecimens(section, {  appearance: 'plain',  properties: ['text-decoration-line', 'text-decoration-style'],  measure: true,  caption: 'Compare the same words and font with two line styles.',})

Keep a real line when demonstrating its style, thickness or offset. Use longhands to preserve the other parts of a shorthand. Preserve parent and inline-child structure when explaining decoration propagation; a child’s none value cannot erase its ancestor’s line.

Transparent text needs an authored visible paint source, such as a clipped gradient or a nonzero outline. Supply a solid fallback for print when backgrounds may be omitted. A plain specimen does not supply those prerequisites. Interactive subjects retain the shared keyboard focus ring.

Preserve lists and generated content

Render the complete authored list, article and descendants. The plain text surface must not invent a counter name, reset value, marker, item or pseudo-element. Keep reading labels outside the authored article or list and report the property on the element that owns it. Native counter prefixes may remain unresolved counter() expressions in computed styles; inspect their rendered text instead of replacing them with scripted numbers.

Keep marker type, position and image distinct. Use identical content and constraints to compare inside and outside wrapping; supply explicit padding for hanging markers. Image examples need a valid asset or native gradient and a type fallback. A full list-style shorthand resets omitted parts, so independent conditions need longhands.

Keep essential link names and instructions in HTML. A generated indicator supplements the native anchor and can enter its accessible name. Test the actual pseudo-element and preserve keyboard focus. For platform-dependent syntax, show the browser’s real support branch and label an authored fallback clearly.

<DemoExample page="counter-set" section="set-a-counter-on-one-item" /><DemoExample page="list-style-position" section="place-markers-inside-the-content-box" />

Preserve background paint prerequisites

Author the image source, box dimensions, position, size, repeat behavior and backing color in the visible HTML. The plain specimen adds no image, border, padding, clipping or blend mode to the subject. Keep labels and computed readings outside its painted area.

Use the same image and geometry when comparing one longhand. Separate the positioning area (background-origin) from the painting boundary (background-clip). Computed percentages and fit keywords are not measurements of rendered image pixels; pair them with a known source ratio and visible edges.

For attachment, provide real overflowing content and a fixed-height iframe viewport. Test inner-panel and document scrolling independently; do not substitute transformed layers. Keep foreground text readable on its own opaque surface and describe platform-dependent fixed-background behavior in the exported prose.

The recipes link to complete authored examples; copy their HTML and any accompanying theme declarations. Use the guarded text-fill pattern for gradient lettering so unsupported browsers and print retain a solid foreground.

Separate edge paint from layout

Supply border width, style and color explicitly. Compare the same box dimensions and state the box-sizing model: borders occupy layout space, while outlines and shadows do not. Use writing-mode comparisons when teaching logical edges. A transparent border keeps its used width; a none or hidden style does not on an ordinary box.

The plain specimen adds no border, outline, radius or shadow to the subject. Keep the live readings and labels outside it. Radius does not clip descendant content on its own; show the separate overflow rule when clipping is part of the example.

Use native focusable controls for outline conditions. Keep a visible keyboard focus treatment, enough space for outward rings, and a real destination for skip links. Distinguish the full outline shorthand from independent longhands, and report native keyword widths as browser-computed values.

Compile authored theme declarations with their examples. The shadow recipe enables the preview's theme control explicitly, so users can compare actual token values in both modes. Raw paint values remain literal unless the author supplies a theme-dependent token or condition.

Preserve source and fragment geometry

Table specimens need adjacent semantic cells and explicit cell borders. Computed spacing alone does not prove a gap: collapsed tables ignore it. Keep captions and annotations outside the measured seams.

For border images, use a loadable source with known dimensions and visible corner/edge patterns. Author its regular border, slices, image width and repeat behavior. Distinguish source coordinates from destination paint; native width and outset numbers are multipliers. Reserve actual layout space when outward paint needs room.

Inline-fragment specimens keep one real inline element inside an explicitly sized container. Supply its text, line height, padding and decoration. Let native wrapping create the fragments, and compare standard/prefixed support without replacing the text with separate boxes.

Preserve media size and paint context

Give image specimens a loadable source with known natural dimensions and an explicit content box. Keep fitting and positioning independent from annotations. A source with a visibly round feature makes stretching distinguishable from cropping.

SVG specimens need real paths, a viewBox, viewport dimensions and explicit paint prerequisites. A computed stroke width does not report its final thickness after the viewBox transform. Keep non-scaling effects on the painted shape. Native controls provide state and accessible names for decorative icons; theme comparisons keep geometry constant.

Preserve paint context and interaction

Filter examples need visible source detail and reserved room for paint outside the layout box. Use transparent artwork to distinguish an alpha-following drop shadow from a rectangular box shadow. Backdrop examples must include the actual background content and foreground panel, with explicit translucency and readable text.

Keep clipping and masking geometry in the authored HTML. Clip boundaries change pointer hit testing; masks on CSS boxes leave it unchanged. Place annotations and essential controls outside effects that could hide them. A fading scroll region needs real overflow, a native accessible name, keyboard focus and a description that stays readable.

Author blending groups and their complete backdrops explicitly. Use isolation only where the example calls for a bounded group. Whole-element opacity also fades descendants without disabling them; compare it with color alpha when only a surface should fade. Test native control behavior and restore appropriate paint in print.

Preserve native shape wrapping

Shape specimens need a real float, explicit dimensions and adjacent inline content. Keep labels and measurements outside that formatting context. Author the painted shape separately: shape-outside changes wrapping without clipping or resizing the artwork. Name the reference box when margins could otherwise shift the shape’s coordinates.

Shape-margin expands the wrap contour within the float’s margin box. Reserve ordinary margins when a larger contour needs room. For image thresholds, use a loaded source with known alpha values and preserve its painted appearance across comparisons. Gradients and transparent same-origin images make threshold behavior visible without substituting positioned text.

Preserve transform geometry and hints

Keep the original layout slot and pivot guides outside the transformed element. Use actual native controls for hover, focus and pressed states. Report client bounds separately from layout dimensions: getBoundingClientRect includes transforms, and SVG strokes can paint beyond its reported rectangle.

SVG examples need explicit viewBox, source coordinates and reference-box differences. For 3D scenes, author the perspective, transformed parent and translated child together. Do not add opacity, filters, isolation or clipping to that parent merely for decoration; grouping effects can flatten its descendants. Compare actual depth geometry as well as computed properties.

Will-change specimens expose the declared hint and its lifetime. Keep their controls visible, prepare the hint before the demonstrated change when appropriate, and release it afterward. A computed hint does not establish a performance gain. Timed interactions use the motion preference; their native states remain inspectable without interpolation.

Preserve native transition timelines

Use a visible native control and author both CSS endpoints. The moving or fading subject owns its transition longhands; these properties are not inherited. Keep the trigger separate when movement could make hover unstable, and place the duration, delay and easing readings outside the subject.

For comparisons, keep distance and endpoints explicit. Use actual CSS transitions, including their waiting interval and state-specific easing. Gate both duration and delay for reduced motion, retain an immediate print state, and let native transitions finish when preferences change. Playback controls should pause only demos that explicitly opt into them.

Preserve native animation phases

Keep the ordinary value, starting keyframe and ending keyframe distinct when teaching fill. Declare duration, delay and count explicitly; use the same path when comparing timing or direction. Preserve complete SVGs and leave status text stationary.

Playback controls operate on the browser’s actual CSS Animation objects. Retain finished one-shot timelines for replay, pause by default, and treat manual Play as an explicit motion preview. CSS play-state examples own their native checkbox and focus selectors instead; the toolbar must not override the property being taught. Their running rules require both screen media and the motion preference.

A timeline readout reports elapsed timeline time and native progress; a property readout still reports the authored CSS value. Keyframe-level easing may override the element’s easing for an interval. Neither readout is a performance measurement.

Preserve native input and accessibility

Keep complete native controls, their options, labels and descriptions in the displayed HTML. Appearance, accent, caret and cursor change presentation; they do not supply activation or disabled behavior. Use an actual checkbox, disclosure or form action to make the result observable. Independent comparison specimens scope IDs together with their for, ARIA and local-link references so names and descriptions remain connected.

Pointer hit testing and keyboard access are separate. Preserve real overlay geometry and inherited child rules, and test both pointer input and keyboard activation. Observe native resize handles and text-selection gestures without setting dimensions or selections to manufacture the expected result.

Use touch input to test touch-action; mouse dragging cannot reproduce gesture arbitration. Keep named scroll regions and keyboard access, and describe the platform limits of resize and vendor drag behavior. A native drag readout only observes dragstart and dragend; it never makes an element draggable or cancels its events. Every example that depends on a vendor property needs an explicit support note and a portable alternative where available.

Keep examples portable

DemoExample connects a utility page and section to its authored HTML and CSS snippets. The displayed structure should own every prerequisite needed to reproduce the behavior; shared recipes provide paint, annotations and controls. The Rust renderer compiles the actual utility classes. Keep the complete teaching explanation and framework-neutral example alongside the demo so Markdown and search exports remain useful. Wrap long HTML class attributes between complete utilities, keeping the taught property readable in the document column; never split an individual class across lines.

<DemoExample  page="clear"  section="clearing-both-left-and-right-floats"/>


© 2026 Aoyue Design LLC.MIT License
Trademark Policy