Partial Period

Partial Period is a copy-paste React component that stops today looks like a slump vs yesterday before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/partial-period
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsToday looks like a slump vs yesterday

Was this component page useful?

How do I install Partial Period?

pnpm dlx shadcn@latest add @bollard/partial-period

The files land in your project. They're yours to edit.

How do I use Partial Period in React?

partial-period-usage.tsx
import { PartialPeriod } from "@/components/ui/partial-period"

<PartialPeriod
  className="max-w-md"
  label="Orders today"
  current={today}
  previous={yesterday}
  elapsed={14.25}
  cutoffLabel="2:15 PM"
  bucketLabels={hours}
  defaultMode="full"
/>

What input mistakes does Partial Period catch?

  • Today-so-far compared against all of yesterday
  • The current bucket shown as if complete: hatched instead
  • Projection presented as fact: labelled as an estimate
  • Full-period mode chosen: warning with a one-tap switch back

What props does Partial Period accept?

PartialPeriod props
PropTypeDefault
label* (required)

Metric name, e.g. "Orders".

string—
current* (required)

Current period per bucket; buckets that haven't happened yet can be null.

(number | null)[]—
previous* (required)

Previous, complete period per bucket.

number[]—
elapsed* (required)

Buckets elapsed in the current period, with a fraction for the one in progress.

number—
bucketLabels

Axis label per bucket, e.g. "12 AM", "6 AM". Every few are shown.

string[]—
cutoffLabel* (required)

Where the current period is cut, e.g. "2:15 PM" or "13 Oct".

string—
currentLabel

Name of the current period, e.g. "Today".

string"Today"
previousLabel

Name of the previous period, lower case, e.g. "yesterday".

string"yesterday"
mode

"to-date" compares like for like; "full" compares with the whole previous period.

"to-date" | "full"—
defaultMode

Initial comparison mode when uncontrolled.

"to-date" | "full""to-date"
onModeChange

Called when the user switches between to-date and full.

(mode: "to-date" | "full") => void—
higherIsBetter

Whether a rise is good news.

booleantrue
showProjection

Show where the period is heading, marked as an estimate.

booleantrue
format

Number format for totals.

(value: number) => string(v) => plain.format(v)
toDateLabel

Templates: `{current}`, `{previous}`, `{cutoff}`, `{pct}`, `{change}` and `{value}` are filled in.

string"By {cutoff}"
fullLabel

Label for the full-period option.

string"All of {previous}"
soFarText

Template for the so-far comparison.

string"{current} so far · {pct} of the period"
warningText

Shown when comparing against the full previous period.

string"{current} is only {pct} done, so comparing it with all o…
fixLabel

Button text to switch back to like for like.

string"Compare by {cutoff}"
projectionText

Template for the projected finish.

string"On pace for about {value} if the rest follows {previous}."
partialLabel

Label for the bucket still filling.

string"so far"
estimateLabel

Label marking the projection as an estimate.

string"estimate"

* required. Also accepts the native props of <figure> (className, aria-*, data-*…), passed through to it.

How is Partial Period accessible?

  • Mode switch is a labelled radiogroup
  • Change and warnings are in polite live regions with text direction, not only arrows
  • The bar chart is aria-hidden; the numbers are given in text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Projection assumes today follows yesterday's shape
  • Works with the buckets you pass; it doesn't fetch data
  • One previous period, not a seasonal baseline

What expensive mistakes does Partial Period stop?

Today looks like a slump vs yesterday

Also known as

analytics · dashboard · today vs yesterday · period comparison · kpi · mtd · chart · projection

What dependencies does Partial Period require?

Partial Period facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component namePartial Period
Registry identifier@bollard/partial-period
Install commandnpx shadcn@latest add @bollard/partial-period
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Partial Period

What form validation mistake does Partial Period catch?

Partial Period prevents today looks like a slump vs yesterday. Compares today so far with yesterday at the same minute by default, so a still-filling period doesn't read as a slump. Catches: Today-so-far compared against all of yesterday, The current bucket shown as if complete: hatched instead, Projection presented as fact: labelled as an estimate, Full-period mode chosen: warning with a one-tap switch back. Limitation: validate partial-period schemas on backend.

How do I install partial-period with shadcn?

Run `npx shadcn@latest add @bollard/partial-period`. Sources added: registry/default/partial-period/partial-period.tsx. Package requirements: lucide-react.

What props customize Partial Period?

Partial Period accepts `label`, `current`, `previous`, `elapsed`, `bucketLabels`. Configures analytics, dashboard, today vs yesterday behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of partial-period?

Projection assumes today follows yesterday's shape. Works with the buckets you pass; it doesn't fetch data. One previous period, not a seasonal baseline Server requirement: backend verification for partial-period.

How does Partial Period meet accessibility guidelines?

Mode switch is a labelled radiogroup. Change and warnings are in polite live regions with text direction, not only arrows. The bar chart is aria-hidden; the numbers are given in text. Minimizes errors: today vs yesterday unfair, partial day comparison.

Which components pair with Partial Period?