minimal
The smallest app.
Run it
cargo run -p duolith-cli -- dev examples/minimal # live, reloads on save
cargo run -p duolith-cli -- build examples/minimal # static output in examples/minimal/dist
The folder on the web: examples/minimal.
Features it shows
| Feature | Where | Screenshot |
|---|---|---|
<button> | minimal pages/index.duo | minimal-pressed.png |
state() | minimal pages/index.duo | minimal-pressed.png |
Source
pages/index.duo
---
import { state } from "@duolith/client";
let count = state(0);
function increment() {
count = count + 1;
}
---
<screen title="Counter" class="p-6 gap-4 items-center bg-canvas">
<text class="text-title text-ink">Pressed {count} times</text>
<button
class="px-4 py-2 rounded-md bg-primary text-on-primary pressed:bg-ink"
on:press={increment}
>
Press me
</button>
</screen>