Overview
Patterns show how several Kern components work together in typical admin screens: filtering a device list, empty and error states, bulk actions, long-running jobs, saved table views, and complete reference flows. They are recipes, not components. You copy the markup and adapt the script to your app.
Kern draws the interface; your app owns the rest:
- Kern: layout, controls, states (loading, empty, error), keyboard and screen-reader behaviour, translatable texts.
- Your app: data, API calls, filter and selection state, permissions, what an action does and whether it is allowed.
The examples run against docs/assets/mock.js, which provides fixed example devices and a pretend server with delays and errors. Nothing in it is part of Kern.
A list loaded from a server
The table pages on the server (controlled="external"): on kernPageChange and kernSort the script asks the pretend server for one page and sets rows, total and loading. Every other pattern builds on this loop.
Writing a pattern page
Each page is a Markdown file in docs/patterns/ named NN-slug.md. The number sets the order in the navigation. The page starts with a # title and an introduction. Every ## section that follows becomes one live example with its own html and js blocks, just like the component examples. In the script, root is the example's container. await import('../assets/mock.js') loads the example data, and await import('../kern/index.esm.js') loads functions like toast() or confirm().