Frontend
- Introduction
- Where the files live
- The default views
- Configuration
- Updating io/ui
- Updating the application
- Using io/ui
- Adding your own styles and scripts
- Content Security Policy
- The framework snapshot
- Troubleshooting
Introduction
A new dust application ships io/ui, a dependency-free frontend framework of CSS tokens, components, and native JavaScript behavior. There is no build step at runtime and no Node.js in the deployment: the browser loads one stylesheet and one ES module.
io/ui handles the app shell, headers, navigation, forms, tables, overlays, theming, and the responsive behavior behind data-* attributes. dust ships a prepared copy in each application, so the interface works offline and a deploy never waits for an asset host.
That choice keeps the production story simple. There is no node_modules to install on a server, no bundle to build before the binary starts, and no framework runtime to hydrate. You write HTML in a view, add io/ui classes, and the browser does the rest. If you later want a JavaScript framework, you can add one alongside io/ui; the framework does not require one.
Where the files live
dust new writes the prepared assets to public/vendor/io-ui:
public/vendor/io-ui/
├── paz.css the framework and page styles
├── paz.js the framework behavior
├── preferences-boot.js applies saved preferences before first paint
├── sprite.svg the icon sprite
├── version.json the installed release
└── fonts/
├── open-sans-latin.woff2
└── open-sans-latin-ext.woff2The default layout links them from /vendor/io-ui:
<script src="/vendor/io-ui/preferences-boot.js"></script><link rel="stylesheet" href="/vendor/io-ui/paz.css"><script type="module" src="/vendor/io-ui/paz.js"></script>preferences-boot.js is a classic script, not a module, and it runs before the stylesheet paints. It reads the preferences saved in local storage, such as the text size, font, accent, and contrast, and applies them to the document. Keeping it in the head, before the stylesheet, avoids a visible reflow for a user who chose a larger font or a different accent.
The assets are served from public/, so they need no route and no controller. In production, let nginx or your CDN serve them. When you update io/ui, the file contents and version.json change together; if your CDN caches aggressively, purge /vendor/io-ui or version the path in the layout when you deploy.
The default views
The generated resources/views/layout.html holds the document head and the blocks. The welcome page extends it and builds the first screen from io/ui classes:
{% extends "layout.html" %}{% block content %}<header class="site-header site-header-sticky"> ...</header><main class="landing-main"> <div class="container"> <section class="landing-hero"> ... </section> </div></main>{% endblock %}The home handler renders it:
use dust::view::{View, view};pub async fn index() -> View { view("welcome", ())}Edit the view to change the page. The layout already includes the theme toggle behavior; no JavaScript is needed for it. A page that extends the layout only overrides the blocks it needs, so you can add pages without repeating the head, the navigation, or the footer. The templates guide covers blocks, includes, and components.
Configuration
config/frontend.toml names the frontend and where updates come from:
framework = "io-ui"# Where `dust ui:update` checks for a release and downloads its assets.# site = "https://ui.pazu.ink"# assets = "https://assets.pazu.ink"site serves version.json; assets serves paz.css, paz.js, the sprite, and the fonts. Both have the values above as defaults. The file is read by the ui:update command, not by the running application, so changing it doesn't restart anything.
The framework key must be io-ui. Another value makes ui:update stop with an error instead of guessing where to download from. The configuration guide covers the TOML helpers if you want to read the file from your own command.
Updating io/ui
dust ui:updatedust ui:update --checkdust ui:update --forceui:update reads the latest version from {site}/version.json, compares it with version.json in public/vendor/io-ui, and downloads the release when it differs. --check only prints the installed and latest versions. --force downloads even when the versions match.
installed: 0.0.12 (2026-11-28)
latest: 0.0.13 (2026-12-02)The command downloads each file and writes it in place, one at a time, so a network failure can leave a partial update; run the command again to finish. preferences-boot.js comes from the dust snapshot because the asset host doesn't serve it separately.
ui:update needs the network, so it is not part of cargo build or a server start. Run it when you want a new release, commit the changed files under public/vendor/io-ui, and deploy them with the rest of public/. A deploy without network access still works because the assets are already in the repository.
Updating the application
dust update rebuilds the application against the framework on disk and refreshes the io/ui assets in one step:
dust updatedust update --releasedust update --pulldust update --downloaddust update --source https://example.com/dust-framework-src.tar.gzdust update --depsdust update --no-uiconfig/update.toml names the source for --download:
source = "https://dustapp.dev/dust-framework-src.tar.gz"--source overrides the file for one run, and DUST_FRAMEWORK_URL overrides it for the process.
--releasebuilds the release profile, then updates the assets with that binary.--pullrunsgit pull --ff-onlyin the framework's checkout. It refuses when the checkout has uncommitted changes.--downloaddownloads the source fromconfig/update.toml(or--source) and replaces the framework folder, keepingtarget/and.git/.- Without either flag, a git checkout is pulled and a plain folder is downloaded, so the same command updates a development checkout and a server.
--depsrunscargo updatebefore the build.--no-uiskipsui:update.
Run it after the framework source changes, so the app binary picks up new commands and fixes.
Using io/ui
The framework's documentation is at ui.pazu.ink/docs. In a dust view, use the classes directly:
<a class="btn btn-primary" href="/posts">New post</a><article class="card"> <div class="card-head"> <div class="card-heading"> <h2 class="card-title">Recent posts</h2> <p class="card-subtitle">Published this week</p> </div> </div> <div class="card-body">...</div></article>Components
io/ui classes are ordinary CSS classes, so they work in any element and in a template component. A button, a badge, and a card are just the documented class names on the element that fits your markup:
<button class="btn btn-ghost" type="button">Cancel</button><span class="badge badge-success">Published</span><table class="table"> <thead> <tr><th>Title</th><th>Status</th></tr> </thead> <tbody> {% for post in posts %} <tr><td>{{ post.title }}</td><td>{{ post.status }}</td></tr> {% endfor %} </tbody></table>Use semantic elements first and add the class that styles them. A <button> with btn keeps keyboard behavior, focus handling, and form submission; a <div> with the same class does not. The same rule applies to links: a link that navigates stays an <a>.
Behavior with data attributes
Behavior comes from data attributes, such as data-theme-toggle, data-dropdown="#menu", data-offcanvas-open="#panel", and data-accordion. The bundled paz.js initializes them on load and watches for markup added later.
<button type="button" data-theme-toggle>Toggle theme</button><button type="button" data-dropdown="#account-menu">Account</button><ul id="account-menu" hidden> <li><a href="/profile">Profile</a></li></ul>Because the behavior is delegated and observes the DOM, markup rendered by a fragment or added by your own script keeps working without re-initialization. Do not bind the same behavior twice; let paz.js handle the attribute instead of attaching your own click listener to the same element.
Themes and saved preferences
preferences-boot.js applies the saved preferences before first paint. The theme toggle writes the user's choice through io/ui's preference storage and updates the document, so the choice survives navigation and a reload. A user who has never chosen gets the system preference.
If you add a theme-aware style of your own, express it in terms of io/ui's tokens rather than fixed colors, so it follows the active theme. The tokens are documented with io/ui; use the same variable names the framework uses, and avoid overriding them globally unless you mean to change the whole application.
Adding your own styles and scripts
Put your CSS and JavaScript under public/ and link them from the layout, after the io/ui stylesheet so your rules can override it:
<link rel="stylesheet" href="/vendor/io-ui/paz.css"><link rel="stylesheet" href="/css/app.css"><script type="module" src="/js/app.js"></script>public/ is served as it is, so the paths are exactly the files' paths under public/. There is no manifest and no hashed filename to look up. If you want cache busting, add a version query string yourself, as io/ui does.
Keep a script that needs data from the page small. Pass the data with a JSON script tag or a data- attribute on the element it belongs to; the templates guide shows the js filter that escapes it safely.
If you prefer a build tool for your own assets, run it outside the application and commit its output under public/. The framework does not run it, and the server never needs Node.js. Do not point the build at public/vendor/io-ui; that directory belongs to ui:update.
Content Security Policy
A strict Content-Security-Policy can block the inline styles or scripts a component uses. Serve the policy from a middleware and give each request a nonce with view::use_csp_nonce, then read it in the template with csp_nonce(). The templates guide has a complete middleware example.
paz.js is an external module, so allow it with script-src 'self' or the nonce you generate. preferences-boot.js is a classic script in the head; give it the same nonce or serve it from 'self'. Test the policy with the browser console open: a blocked resource names the directive that rejected it.
The framework snapshot
The copy in resources/io-ui is the snapshot dust new embeds. It is versioned with the framework and carries the io/ui MIT license. To refresh it, build io/ui from its repository, copy the prepared files into resources/io-ui, and update version.json. The repository's resources/io-ui/README.md lists the exact files.
Changing the snapshot affects every new application, not the ones already created. An existing application updates through dust ui:update, which reads the configured site rather than the framework's snapshot.
Troubleshooting
| Symptom | What to check |
|---|---|
| The page has no styles | public/vendor/io-ui/paz.css exists, and the layout links /vendor/io-ui/paz.css under the base path. |
| Icons are blank | sprite.svg is present and the element uses the documented icon name. |
| Saved preferences reset on navigation | preferences-boot.js is in the head and loaded before the stylesheet, not at the end of the body. |
| A page reflows as it loads | The boot script is missing or blocked; the saved font and size apply only after it runs. |
| A dropdown does nothing | paz.js loaded without a console error, and the trigger's data-dropdown points at an element's id. |
ui:update fails |
config/frontend.toml names a reachable site and assets, and the machine can reach them. |
ui:update changes nothing |
The installed and latest versions match; use --force to download anyway. |
| A deploy serves an old stylesheet | The browser or CDN cached the old file; ui:update adds ?v=, but your own assets need their own version string. |
Open the browser's network panel first. A missing file returns 404 and shows the exact URL the page requested, which is usually enough to spot a wrong base path.