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.
Structure recedes. The behavior stays in focus.
Real CSS, real boundaries, useful annotations.
A consistent system across every reference.
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.
<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.
A stable reading surface.
A layer above its backdrop.
Form follows function.
Use meaningful content to make layout decisions visible.
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.
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.
<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.
- 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.
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.
Learn 2
Start with the concepts and a working example.
Utilities 4
Look up a specific layout behavior.
Foundations 2
Share values across the interface.
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.
@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:
- Quick start, Vite, CLI and VS Code pair each action with its result.
- Webpack, Rspack and Rsbuild keep full configuration files readable.
- Astro and SvelteKit connect layouts with server hooks.
- Express, PHP and Rails connect independently built assets with complete server templates.
- Laravel, WordPress and Shopify preserve the host's asset helpers and layout hooks.
- ASP.NET Core and Blazor make asset-build, host-build and publication order explicit.
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- light
var(--color-white)darkvar(--color-gray-90) smooth
--easing-smooth- Default
cubic-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.
| Namespace | Consumers |
|---|---|
color-text-* |
Show 2 more keys
|
duration-* |
|
spacing-* |
Show 123 more keys
|
<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.
| Group | Utility keys | Description |
|---|---|---|
| Surfaces | surface | Panels, cards and overlays. |
| Line roles | b, border-color, outline-color, stroke | Borders, 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.
| Token | Value | PX | Representation |
|---|---|---|---|
--spacing-4xs | .125rem | 2px | |
--spacing-3xs | .25rem | 4px | |
--spacing-2xs | .375rem | 6px | |
--spacing-xs | .5rem | 8px | |
--spacing-sm | .75rem | 12px | |
--spacing-md | 1rem | 16px | |
--spacing-lg | 1.5rem | 24px | |
--spacing-xl | 2rem | 32px | |
--spacing-2xl | 3rem | 48px | |
--spacing-3xl | 4rem | 64px | |
--spacing-4xl | 6rem | 96px | |
--spacing-5xl | 8rem | 128px |
<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.
- 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' }]} />- 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.
- HTML
- Base CSS
- Runtime script
- Manifest JSON
- HTML
- Base CSS
- Runtime script
- Manifest JSON
<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' } ]}/>- Entry
- Dependency
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.
<DemoStyleComparison html='<p class="message">Saved to your workspace.</p>' css='.message { padding: 1rem; font: 500 1rem/1.5 system-ui; }' height={160}/>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.
- Observe
Read connected elements and receive DOM class changes.
- Ensure
Interpret complete classes with the project manifest.
- 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.' } ]}/>- Write
Prepare the source content.
- 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 CSS | Master CSS |
|---|---|
border-radius: .75rem | r:.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.
| Token | CSS |
|---|---|
@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.
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.
bg-blue-60 p-md flex gap-smflex gap-sm p-md bg-blue-60<span class="text-decoration:bad()">Note</span>@master/css/no-invalid-classesClass "text-decoration:bad()" emits invalid CSS: Invalid value for `text-decoration` property.
<button class="fg-white bg-blue-60:hover@sm"> Save</button>@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.
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.
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.
- Preview
Request a scoped diff. The server leaves workspace files unchanged and returns a token when changes exist.
- Review
Check the full diff and intended behavior before asking the client to apply it.
- 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.
<button class="bg-blue-60 p-md flex gap-sm">Save</button><button class="flex gap-sm p-md bg-blue-60">Save</button><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
export declare function createEngine( options: MasterCSSEngineOptions): Promise<MasterCSSEngine>;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
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.
@theme { --color-brand: #4f46e5;}.card { background-color: var(--color-brand);}.card { background-color: var(--color-brand);}@layer theme { :root, :host { --color-brand: #4f46e5 }}@theme inline { --color-brand: #4f46e5;}@safelist "bg-brand";@layer utilities { .bg-brand { background-color: #4f46e5 }}@theme static { --color-brand: #4f46e5; @keyframes fade-in { to { opacity: 1; } }}@layer theme { :root, :host { --color-brand: #4f46e5 }}@keyframes fade-in { to { opacity: 1 }}<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.
Ranking bars
Sample data for comparing one metric across fixtures. Bar lengths share a common zero and maximum.
Stacked payload bars
Each row fills its own width to show composition. Compare the printed totals to compare payload size.
Metric summary
Sample data for dense benchmark summaries.
- Fixture
- dashboard
- Median build
- 148 ms
- 10 measured rounds
- Warm rebuild
- 28 ms
- single class edit
- Generated rules
- 1,284
- after pruning
- Long tasks
- 0
- Chromium trace sample
Readable labels and zero values
Labels wrap in the available column. A zero value has no colored fill.
Local trace
Data tableIllustrative measurements by fixtureComplete measurements · scroll for more columns
| Fixture | Raw CSS | Brotli CSS | Build median | Samples | Environment |
|---|---|---|---|---|---|
| Fixture A | 100 kB | 18.4 kB | 148 ms | 10 | Illustrative local fixture |
| Fixture B | 100 kB | 21.8 kB | 148 ms | 10 | Illustrative local fixture |
| Fixture C | 100 kB | 34.2 kB | 148 ms | 10 | Illustrative local fixture |
| Fixture D | 100 kB | 38.6 kB | 148 ms | 10 | Illustrative local fixture |
EvidenceSee real benchmark sources (this date is illustrative)Recorded
Delta labels
Sample data for compact comparison badges.
Sample summary
Sample data for raw benchmark rounds.
- Median
- 16.8 ms
- Mean
- 17.1 ms
- Min
- 14.2 ms
- Max
- 22.4 ms
- Samples
- 25
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.
<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.
<button type="button" class="px-md py-sm r-sm bg-blue fg-white">Hello Lit</button>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.
<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 ↗Size and treatment
View guide ↗Finite entrances
View guide ↗State transition
View guide ↗Dialog entrance
View guide ↗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
blue
violet
Color roles
View guide ↗Surface hierarchy
View guide ↗Line roles
View guide ↗Text roles
View guide ↗Base hue
View guide ↗Text hue
View guide ↗Quiet elevation
View guide ↗Interactive elevation
View guide ↗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 / class | Role |
|---|---|
--shadow-smshadow-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 ↗Container grid
View guide ↗Space to compose
A single column stays readable in a sidebar. A wider container gives the image its own track.
Container media object
View guide ↗Field notes
A small archive of places, textures and quiet details from the trail.
Fluid wrapper and measured object
View guide ↗Measured avatar. Flexible content.
One axis or both
View guide ↗Shrinkable content
View guide ↗field-notes-autumn-collection-final-v03.fig
Radius scale
View guide ↗Shape shortcuts
View guide ↗<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
Follow a native floating shapeshape-outside
Reserve a shape’s surrounding spaceshape-margin
Extract wrapping from image alphashape-image-threshold
Flexbox & grid11 recipes
Arrange on two axesalign-items
Keep fixed and flexible regionsflex
Measure distributed free spaceflex-grow
Preserve the source sequenceorder
Separate track and item alignmentplace-content
Stretch automatic dimensionsalign-items
Keep overflowing content reachablejustify-content
Distinguish explicit and implicit tracksgrid-auto-columns
Pack cells without reordering focusgrid-auto-flow
Map responsive named regionsgrid-template-areas
Compare flexible track minimumsgrid-template-columns
Sizing & spacing6 recipes
Expose the box modelpadding
Measure intrinsic content widthswidth
Release an automatic flex minimummin-width
Follow logical padding directionspadding
Distinguish ratio from fixed dimensionsaspect-ratio
Observe constrained native resizingresize
Position & scrolling5 recipes
Keep context in viewposition
Compare local paint orderz-index
Separate clipping from scrollingoverflow
Reserve a viewing insetscroll-padding
Observe native scroll chainingoverscroll-behavior
Typography17 recipes
Give content a rhythmtext-wrap
Preserve an inherited resetfont-style
Measure actual digit advancesfont-variant-numeric
Compare inherited line heightsline-height
Align against a native text baselinevertical-align
Preserve meaningful whitespacewhite-space
Separate wrapping from intrinsic widthoverflow-wrap
Keep the full description reachableline-clamp
Follow native column progressionwriting-mode
Remove decoration at its origintext-decoration
Separate glyph fill from foregroundtext-fill-color
Compare paint without resizing texttext-stroke-width
Preserve running counter scopecounter-set
Compare native hanging markerslist-style-position
Keep meaning in the link textcontent
Preserve native inline fragmentsbox-decoration-break
Keep selection boundaries explicituser-select
Color & media9 recipes
Separate paint from positioningbackground-origin
Preserve focused background changesbackground
Compare image fit and cropbackground-size
Observe native background attachmentbackground-attachment
Keep the image box independent of fitobject-fit
Place content within its cropobject-position
Compare theme and palette paintfill
Distinguish SVG units from screen paintstroke-width
Compare SVG transform reference boxestransform-box
Edges & effects12 recipes
Isolate an external backdropisolation
Show the layers beneathbackdrop-filter
Follow physical and logical edgesborder
Separate curves from clippingborder-radius
Inspect mode-specific shadow layersbox-shadow
Compare native shared table edgesborder-collapse
Separate source slices from border paintborder-image-slice
Fit actual patterned edge tilesborder-image-repeat
Follow transparent source silhouettesfilter
Separate clipped paint from layoutclip-path
Fade a real scrollable regionmask-image
Bound blending with an explicit groupmix-blend-mode
Motion13 recipes
Choose deliberate snap stopsscroll-snap-stop
Make time visibleanimation-direction
Keep layout and transform bounds distincttransform
Anchor a scale to its pivottransform-origin
Expose native 3D flatteningtransform-style
Select which changes interpolatetransition-property
Compare travel distance and durationtransition-duration
Stagger real sibling transitionstransition-delay
Compare progress through timetransition-timing-function
Separate delay from active progressanimation-delay
Retain native start and end statesanimation-fill-mode
End within a fractional cycleanimation-iteration-count
Apply easing at the keyframe intervalanimation-timing-function
Interaction10 recipes
Keep controls accessiblescreen-readers
Show actual keyboard focusoutline
Preserve interaction under opacityopacity
Prepare and release an actual browser hintwill-change
Pause decoration while editinganimation-play-state
Keep the platform control intactaccent-color
Restyle a native selectappearance
Separate pointer targeting from focuspointer-events
Distinguish touch gestures from scrollingtouch-action
Observe actual native drag startsuser-drag
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.
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.
<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"/>