Docs components demo
This page exercises every docs component. It doubles as a visual test page.
UiScreen
UiCli
- Web UI
- CLI / config
Open Stacks and press New stack.
clouduler stack deploy web.yaml
SetupForm and Cmd
ssh {{user}}@{{ip}}
[arch] sudo pacman -S docker
[debian,raspbian] sudo apt install docker.io
clouduler init --name {{cluster}}
{{user}}{{ip}}{{cluster}} (fill in the setup form above)DistroTabs
- Arch Linux
- Debian
- Raspberry Pi OS
sudo pacman -S docker
OptionTable
cluster.namerequiredstringdefault "homelab"Quirk
Mermaid
How screens are produced
<UiScreen> does not show hand-made screenshots. It embeds the real web UI, built against an in-memory mock backend (ui/src/mock/). All network access in the UI goes through one transport seam, and the mock swaps it for fake routes backed by a scenario, so every screen is clickable and always matches the current UI code.
- Scenarios (
ui/src/mock/scenarios/) describe a whole cluster: nodes, networks, stacks, instances. Pick one with thescenarioprop. - Contract tests (
ui/src/mock/contract.test.ts) check the mock against the real API client, so the mock cannot silently drift from the backend. An unmocked route logs[mock]to the console and answers 501. - Fallback images: if the mock is not served (no JavaScript, or the mock is missing),
<UiScreen>showsstatic/img/ui/<slug>.png, generated by Playwright from the same mock. Each live screen also has an "Open full screen" link.
Add a scenario
- Create
ui/src/mock/scenarios/my-scenario.tsexporting a function that returns aMockDbbuilt withScenarioBuilder. - Register it in
ui/src/mock/scenarios/index.ts. - Use it:
<UiScreen scenario="my-scenario" route="/stacks" alt="..." />.
The contract and render tests pick it up automatically. Use example.com domains and documentation IPs only. See ui/src/mock/README.md for the builder API.
Regenerate screenshots
npm run setup:browsers # once: installs Playwright chromium
npm run build:ui-mock # builds the UI against the mock into static/ui-mock/
npm run screenshots # renders light and dark PNGs for every <UiScreen>
npm run build:full # all of the above, then the site build
npm run screenshots scans content/**/*.mdx, so a new <UiScreen> is picked up without configuration. It skips PNGs newer than both the mock build and the page; pass -- --force to redo everything. It exits non-zero if any page throws or logs a [mock] error, listing them all. static/ui-mock/ and static/img/ui/ are gitignored and must be generated at build time.