Chicken bowl
640 kcal
Components · v0.1
Every component takes its states, copy, sounds and haptics from the spec, and works with no JavaScript and no WebGL. To compare Plain Alive States vs Alive States + LavaMorphism under identical live conditions, explore the comparative study.
Input
Type a meal name. Names are checked against a server, so a slow answer turns the field to liquid and a confirmed one sets into obsidian. Try Oats to see a failure.
Surface
A card whose surface follows what is true. Press Add 50 kcal: the new value shows at once, mercury flows out from where you pressed while it is unconfirmed, and it sets with an ember when the server says yes. Choose the network to see it slow, fail or queue.
640 kcal
Toast
The bead is the time left to undo, and it is the Undo: tap it, or drag it back toward what changed and it merges into it. There is no word on the screen, but screen readers and the keyboard still get a button called Undo. Hover or focus a toast to hold it. Alt+T moves keyboard focus to the newest toast; Escape closes the focused toast without acting. Toasts stack three high, newest on top, and focus is never moved to one on its own.
Real markup first. mountInput then adds the surface, the states and the announcements.
<div class="lava-field" id="fName">
<label for="mealName">Meal name</label>
<div class="lava-well">
<input id="mealName" name="mealName"
autocomplete="off" required>
</div>
<p class="lava-msg" role="status"></p>
</div>
const name = mountInput(fName, {
ctx: stage.ctx, // or omit for the CSS-only tier
shader: true,
network: true, // offline queues the check
required: true,
validate: async (value) =>
(await isTaken(value))
? { ok: false,
message: "That name's already used. Try another." }
: { ok: true },
})
| State | When | Surface | Says |
|---|---|---|---|
| Idle | Empty, or just edited | Plain obsidian | The helper text, if any |
| Pending | The check takes longer than 200 ms | Liquid floods from the caret | Checking… |
| Slow | Longer than 1.8x this user's usual wait | Liquid stalls and heaves | Still checking. The connection is slow. |
| Queued | Offline | Liquid pools at the foot, motionless | Can't check this offline. We'll check when you're back online. |
| Confirmed, then settled | The check passes | Sets into obsidian, with an ember flash | Looks good |
| Failed | The check fails | Liquid drains and scatters | The validator's own message |
| Disabled | Not available yet | Matte obsidian | Always the reason |
<label for>. The message is linked with aria-describedby.aria-invalid follows failure and conflict. aria-busy follows pending and slow.role="status" region: polite while working, assertive for failures.