Tutorials

The tutorial section is the guided path through Monster. Use it when API pages tell you what exists, but you still need to understand how the runtime pieces fit together in real code.

Learning Path

Start with setup and orientation, then move into the runtime model

Most teams get value from Monster fastest when they first understand how the library is loaded and how the documentation is structured. After that, the DOM binding model, CustomElement and CustomControl layers become much easier to reason about.

Before You Start

Setup

Install Monster and understand the page structure first

If you do not yet know how Monster is loaded, where example files live or what main.html, run.html, script.mjs and run.mjs mean, do not start with CustomControl. Start with the setup and orientation pages first.

Mental model

Use tutorials after the install works

The tutorial section is not the installation guide. It is the practical bridge from “Monster is loaded” to “I can build, style and reason about real controls without fighting the framework”.

Who This Is For

Developers integrating Monster

Learn how Updater, component options, data attributes and the form-oriented control layer actually work together before you start wiring application-specific behavior.

Designers working with implementation reality

Understand where templating stops, where components encapsulate UI through Shadow DOM and which parts stay safely themeable from the outside.

Recommended Order

1. Load the library and understand the example structure

Start with First Page if you still need npm install, browser imports, a working HTML page or the Playground flow.

2. Learn the DOM templating model

Start with Templating. It explains data-monster-replace, data-monster-bind, data-monster-insert and the proxy-driven update flow that shows up in many higher-level components.

3. Move from local state to shared data contracts

Move to Datasource once the DOM binding model is clear and you want to load, persist or normalize data through a stable contract instead of sprinkling fetch logic through components.

4. Build your own reusable element

Continue with CustomElement when you need your own tags, your own template lifecycle or Shadow DOM encapsulation.

5. Continue into real controls

Finish with CustomControl and then use the component docs for Select, API Button and Button Bar to see the same runtime ideas in production-grade controls.

6. Style the system without breaking it

End with Theming to learn where tokens, PropertyStyleSheet and ::part belong once you want the control to look like your product without fighting Shadow DOM.

What the Tutorials Teach

Runtime mental model

The tutorials explain what changes the DOM, what stays declarative in HTML and when JavaScript should only orchestrate public APIs instead of mutating internals.

Data flow contracts

The datasource tutorial closes the gap between static demos and production code: read paths, write paths, server-backed state and where components should stop owning transport logic.

Safe extension points

You learn the public surfaces that are meant to be used: templates, options, data-monster-*, lifecycle methods and form-aware controls.

System constraints

The guides also surface the practical limits: Shadow DOM boundaries, loader behavior, property stylesheets, paired color tokens and when @container is the safer layout choice.

Styling discipline

The theming tutorial shows how to apply Monster tokens, paired foreground and background colors and stable parts without falling back to brittle internal DOM selectors.

Related reference pages

When you need the deeper API contract, continue into Updater, Datasource, CustomElement and CustomControl.

Choose the Right Entry Point

First Page

Choose this first if you still need installation, a minimal page setup, the basic file layout or a clear explanation of how the Playground fits into the workflow.

Templating

Choose this if you already have HTML and data, and you want a repeatable way to replace content, bind inputs and insert repeated structures without pulling in a full framework abstraction.

Datasource

Choose this if your next problem is no longer DOM output, but stable loading, writing and state transitions between UI and backend-facing data sources.

CustomElement

Choose this if you need a real web component: your own tag, your own Shadow DOM and a reusable primitive that later can evolve into a richer CustomControl.

CustomControl

Choose this if you are building value-bearing controls that participate in forms, validation and option-driven runtime behavior.

Theming

Choose this if the control already works and the next question is how to style it through tokens, property defaults and ::part without breaking the component boundary.

Map Tutorials to Real Controls

Templating

See mapping and repeated content in Select

The templating tutorial pays off quickly in Select: labels, values and mapped records use the same separation between data and rendered DOM, only in a reusable control instead of a manual updater setup.

Datasource

See write lifecycle in SaveButton

The datasource tutorial turns into real value once dirty state, write state and persistence are coordinated through one contract. SaveButton is the clearest production example for that handoff.

CustomElement

See runtime assembly in LocalePicker

If you want a tag with its own behavior, template assembly and callbacks without form-value semantics, LocalePicker is the right next page after CustomElement.

CustomControl

See value handling in Toggle Switch

ToggleSwitch is a compact real-world example for the form-aware control layer: value, state, options and public methods stay explicit and easy to inspect.

Theming

See token pairs and variants in Button

Button is a good theming stress test because it combines system properties, stateful variants and strong visual expectations. If token changes hold there, they usually hold across the rest of the library too.

The current width of the area is too small to display the content correctly.