---
title: "Daily logging"
description: "Repeated entry designed for the ninetieth entry rather than the first, where every saved second compounds and every extra field costs adherence"
url: "https://opsinjs.pensievelabs.org/docs/patterns/daily-logging"
source: "https://opsinjs.pensievelabs.org/docs/patterns/daily-logging.md"
section: "Patterns"
kind: "pattern"
aliases: ["logging a reading", "repeated entry", "diary entry", "tracking flow", "quick add"]
---

> Elements written as `<PascalCase … />` below are opsinjs documentation
> components. Their attributes are the content: the values they render are
> generated from `tokens/*.json` and `registry/catalogue.ts` and are
> published separately at https://opsinjs.pensievelabs.org/r/index.json and under the Reference
> section.
> Nothing is missing from this page. The data simply does not live in
> the prose.

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 [#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](./onboarding-and-first-run.mdx);
* a validated questionnaire, whose item order is fixed: [Questionnaire](../components/questionnaire.mdx);
* values a device syncs: [Offline and stale data](./offline-and-stale-data.mdx);
* correcting history, which deserves a slower flow.

## How it works [#how-it-works]

1. **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.
2. **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.
3. **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.
4. **Warn, never block.** A surprising value gets a question and still saves, because a real reading outside your expected span matters most.
5. **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.
6. **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 |

<NotBuiltYet />

## Components [#components]

* [LogSheet](../components/log-sheet.mdx): the bottom sheet. It blocks no save and records every entry as self-reported.
* [ReadingInput](../components/reading-input.mdx): one measurement with its unit, a unit switch and your warning.
* [Field](../components/field.mdx), [Button](../components/button.mdx) and [Sheet](../components/sheet.mdx): label, save action, keyboard-safe detents.
* [Value](../components/value.mdx), [RelativeTime](../components/relative-time.mdx) and [TimelineEntry](../components/timeline-entry.mdx): the saved entry and its dated history.
* [EmptyState](../components/empty-state.mdx): before anything is logged.
* [ScaleInput](../components/scale-input.mdx) and [DoseTracker](../components/dose-tracker.mdx): a rated scale such as pain, and a dose taken.

## Build a log entry [#build-a-log-entry]

```tsx
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. `onSave` receives your `values` verbatim, so an empty entry still arrives and the emptiness check is yours.
* `warning` is 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.effectText` politely whenever it is not null.

## Example [#example]

<IframePreview kind="screen" name="daily-log-screen" />

The 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 [#accessibility]

* Focus moves into the sheet on open and is trapped while it is modal. <Kbd>Escape</Kbd> 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.
