Patterns
Daily logging
Repeated entry designed for the ninetieth entry rather than the first, where every saved second compounds and every extra field costs adherence
The same person records the same thing for months, such as a blood pressure reading each morning or a dose taken. The target is three taps from the screen they are on: open, enter, save.
When to use it
Use it when the reader knows what the fields mean, most entries resemble the last one, and a missed day is expected rather than an error. Use something else for:
- the first entry, which has to teach units: Onboarding and first run;
- a validated questionnaire, whose item order is fixed: Questionnaire;
- values a device syncs: Offline and stale data;
- correcting history, which deserves a slower flow.
How it works
- Start where the person is. The log action sits on the metric's tile or detail screen as one target, at least 44pt, in the lower third.
- Open a sheet, not a screen. The field is focused with the right keyboard (
inputmode="decimal"for a number), and the context stays visible behind it. - Default the time, unit and metric. The time is now and editable, and the unit is the last one used. Never pre-fill the measurement, because that is how a log fills with numbers nobody measured.
- Warn, never block. A surprising value gets a question and still saves, because a real reading outside your expected span matters most.
- Confirm in place. The entry appears where it will live, with undo. No "Saved!" dialog, no detour to a trends screen, and no streak or praise for a body reading.
- Draw gaps as gaps. A missed day is never interpolated, carried forward or styled as a status.
Decide per metric whether a second entry for one slot replaces the first, sits beside it or is refused. Say which before the person types.
| State | Behaviour |
|---|---|
| Draft | Kept through an interruption and restored with "you had started this" |
| Queued offline | Visible, marked as not yet synced, with the time it was made |
| Conflict | Entries from two devices are both kept and shown, never silently merged |
| Failed | The value is never lost. The reader is told, and the retry is automatic |
NOT IMPLEMENTED. This component does not exist in any released version of opsinjs. There is no package to install, no module to import and no props interface to generate code against. Everything on this page is a specification of intended behaviour and may change without notice. Do not write code against it.
This component is not built yet
PlannedRoadmapWhat “planned” means
Components
- LogSheet: the bottom sheet. It blocks no save and records every entry as self-reported.
- ReadingInput: one measurement with its unit, a unit switch and your warning.
- Field, Button and Sheet: label, save action, keyboard-safe detents.
- Value, RelativeTime and TimelineEntry: the saved entry and its dated history.
- EmptyState: before anything is logged.
- ScaleInput and DoseTracker: a rated scale such as pain, and a dose taken.
Build a log entry
import { LogSheet } from "@/components/ui/log-sheet"
import { ReadingInput } from "@/components/ui/reading-input"
<LogSheet
open={open}
onOpenChange={setOpen}
title="An example entry"
values={{ reading }}
saveLabel="Save the example entry"
onSave={(entry) => store(entry)}
>
<ReadingInput
label="Example measurement"
unit={unit}
units={["kg", "lb", "st"]}
precision={1}
value={reading}
warning={warning}
onChange={(next) => {
setReading(next.value)
setUnit(next.unit)
}}
/>
</LogSheet>- LogSheet never reads its children.
onSavereceives yourvaluesverbatim, so an empty entry still arrives and the emptiness check is yours. warningis a sentence you write from bounds you own. It never marks the field invalid or blocks the save.- A unit switch can convert or clear the number without anybody typing, and ReadingInput mounts no live region. Announce
next.effectTextpolitely whenever it is not null.
Example
NOT IMPLEMENTED. The opsinjs component `daily-log-screen` does not exist in any released version of opsinjs. There is no package to install, no module to import and no props interface to generate code against. Everything on this page is a specification of intended behaviour and may change without notice. Do not write code against it.
daily-log-screen is not built yet
/view/base/base-lyra/screen/daily-log-screen?mode=light, which renders under the product theme rather than the documentation chrome. There is nothing at that address yet.PlannedRoadmapWhat “planned” means
/view/base/base-lyra/screen/daily-log-screen?mode=lightThe daily log screen is still a specification, so its frame shows the not-built notice. Its one lifted surface holds today's reading or an honest empty state.
Accessibility
- Focus moves into the sheet on open and is trapped while it is modal. Escape dismisses it, and focus returns to the control that opened it.
- The unit is part of the field's accessible name, as in "Systolic, in millimetres of mercury".
- The save is announced politely, and undo stays reachable by keyboard while it is offered.
- The keyboard never covers the save, and typed input survives rotation and backgrounding.
- Every gesture has a labelled control, and a stepper is never the only way to enter a number.