Task list
Native checkboxes whose label fades when done, with a short animation when a task is checked or unchecked.
A text field, a select and a checkbox feed a live preview, and Reset clears both.
Type a name, pick a plan, tick the checkbox, then press Reset.
| name | value | previous | changes |
|---|---|---|---|
| Waiting for the preview to start. | |||
Native form controls feeding a preview that is outside them. Each control copies its value into a state on the section with an :on(input) or :on(change) rule; the preview reads the states as DOM text.
None for the preview: CSS can match :checked, :placeholder-shown or :invalid, but it cannot read a field’s text or a select’s value into another element.
--name from another rule does not change the field. For a field that must follow its state, use state("", bind(value)) on the field itself (see the Form mirror example)./* ---- Reactive CSS -------------------------------------------------------------------------- *//* The preview is outside the controls, so the states live on the section around both. */.signup { --name: state(""); --plan: state("basic"); --news: state(false); }/* Each control copies its value up when it changes. */.signup input[type="text"]:on(input) { --name: set(event(value)); }.signup select:on(change) { --plan: set(event(value)); }.signup input[type="checkbox"]:on(change) { --news: set(event(checked)); }/* Reset restores the controls natively; the states follow. */.signup:on(reset) { --name: set(""); --plan: set("basic"); --news: set(false); }.signup:when(--name != "") .name { content: var(--name); }.signup .plan { content: var(--plan); }.signup:when(--news) .badge { display: inline; }Source: site/src/catalog/interfaces/signup-form/. style.css from its Reactive CSS divider; the layout above it and the shared api.css run but are not shown.
Native checkboxes whose label fades when done, with a short animation when a task is checked or unchecked.
A billing switch changes the price and shows the annual saving, with role="switch" kept in sync.
Tabs selected by click or arrow keys, with the ARIA tab pattern written from one state.