02 / Pattern collection

Layout

Let the browser adapt the layout to the available space.

Cards that find their own column count, with useful minimum widths and no layout script.

HTML + CSS · No JavaScript

Core pattern repeat(auto-fit, minmax(min(100%, 16rem), 1fr))
Try the example

Prepare a readable paper layout without claiming that printing succeeded.

HTML + CSS + JavaScript

Core pattern @media print { .print-notes { break-before: page; } }
Try the example

03 / Pattern collection

Interaction

Use native behavior where it helps, and make custom state changes explicit.

Native details FAQ

Interaction

A practical FAQ built from native disclosure controls that work without JavaScript.

HTML + CSS · No JavaScript

Core pattern <details><summary>Question</summary>…</details>
Try the example

Native modal dialog

Interaction

A focused dialog using the browser’s built-in modal behavior and clear close controls.

HTML + CSS + JavaScript

Core pattern dialog.showModal()
Try the example

Stable sortable table

Interaction

Sort the rows already on the page while preserving ties and explaining the current order.

HTML + CSS + JavaScript

Core pattern header.setAttribute('aria-sort', 'ascending')
Try the example

Keyboard action menu

Interaction

A compact menu for commands with deliberate opening, dismissal, and focus behavior.

HTML + CSS + JavaScript

Core pattern aria-haspopup="menu"
Try the example

A timer the reader starts and controls, without urgency or automatic actions.

HTML + CSS + JavaScript

Core pattern remaining = Math.max(0, deadline - Date.now())
Try the example

04 / Pattern collection

Forms

Explain input errors and search results without interrupting the task.

Use familiar stars while keeping native radio behavior and one selected value.

HTML + CSS + JavaScript

Core pattern <input type="radio" name="rating" value="3">
Try the example

A complete example, every time.

Each snippet is a self-contained HTML document with its CSS and any JavaScript included. The live preview uses the exact source shown below it. Copy or download the file, open it in a browser, and edit it in your own project. Original example code includes an MIT license notice.

These are starting points with documented behavior and limits. Test your customized version with your own content and supported browsers. The embedded previews are isolated; clipboard access and saved preferences can be restricted there.