Data Cost Notice

Data Cost Notice is a copy-paste React component that stops big download ate the mobile data pack 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/data-cost-notice
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

StopsBig download ate the mobile data pack

Was this component page useful?

How do I install Data Cost Notice?

pnpm dlx shadcn@latest add @bollard/data-cost-notice

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

How do I use Data Cost Notice in React?

data-cost-notice-usage.tsx
import { DataCostNotice, type ConnectionInfo } from "@/components/ui/data-cost-notice"

<DataCostNotice
  label="1080p"
  bytes={480e6}
  lighter={{ label: "480p · same lecture", bytes: 120e6 }}
  connection={onWifi ? wifi : weakSignal ? weak : mobile}
  onChoose={setChoice}
/>

What input mistakes does Data Cost Notice catch?

  • Large downloads, uploads or autoplay on mobile data
  • Data Saver / Save-Data preference
  • Slow connections, with a rough time estimate
  • A lighter version and how much it saves

What props does Data Cost Notice accept?

DataCostNotice props
PropTypeDefault
bytes* (required)

Size of the full version in bytes.

number—
label* (required)

Name of the full version, e.g. "1080p".

string—
lighter

A smaller alternative: lower quality, compressed, audio only.

{ label: string; bytes: number }—
direction

Uploads are estimated as "over" the time, since upload speed isn't measured.

TransferDirection"download"
verb

Verb for the detail line; defaults to "Downloading"/"Uploading". Use "Playing" for autoplay.

stringdirection === "upload" ? "Uploading" : "Downloading"
connection

Override the browser's reading, e.g. from a `Save-Data: on` request header or a native shell.

ConnectionInfo—
onChoose* (required)

The user picked a version. A deferred choice arrives once the connection stops being a concern.

(choice: "full" | "lighter") => void—
minBytes

Transfers smaller than this only warn when they'd be slow.

number—
slowSeconds

Transfers slower than this always warn, in seconds.

number—
saveDataTitle

Templates: `{verb}`, `{label}`, `{size}`, `{time}`, `{type}` (e.g. "3G") are filled in; `savesText` takes `{saved}`.

string"Data Saver is on"
cellularTitle

Title when on mobile data.

string"You're on mobile data"
slowTitle

Title when the connection is slow.

string"Slow connection ({type})"
detailText

Line giving the size.

string"{verb} {label} uses {size}"
timeText

Line giving the rough time.

string"{time} at this speed"
savesText

Text for how much the lighter version saves.

string"saves {saved}"
waitLabel

Text for the wait-for-Wi-Fi button.

string"Wait for Wi-Fi"
waitingText

Shown while waiting for Wi-Fi.

string"Waiting for Wi-Fi · {label} starts once you're on it"
fullLabel

Text for choosing the full version.

string"{label} anyway"
cancelLabel

Text for cancelling the wait.

string"Cancel"

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

How is Data Cost Notice accessible?

  • Notice content is a role="status" region
  • Version choices are a labelled role="group" of buttons
  • The waiting pulse only animates when motion is allowed

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

What are the limitations and server boundaries?

  • The Network Information API is not available in every browser (notably Safari and Firefox); without it, pass connection details yourself
  • Chrome caps reported bandwidth at 10 Mbps, so times are rough and fast lines aren't called slow
  • "Wait for Wi-Fi" relies on the browser reporting the connection type

What expensive mistakes does Data Cost Notice stop?

Big download ate the mobile data pack

Also known as

mobile data · data saver · wifi only · network information api · save-data · download size · jio · slow 3g

Field type

What dependencies does Data Cost Notice require?

Data Cost Notice facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameData Cost Notice
Registry identifier@bollard/data-cost-notice
Install commandnpx shadcn@latest add @bollard/data-cost-notice
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 Data Cost Notice

How does Data Cost Notice validate Indian financial identifiers?

Data Cost Notice stops big download ate the mobile data pack. Complies with national standards for Large downloads, uploads or autoplay on mobile data, Data Saver / Save-Data preference, Slow connections, with a rough time estimate, A lighter version and how much it saves. Limitation: verify data-cost-notice with issuer gateway.

How do I install data-cost-notice with shadcn?

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

What props customize Data Cost Notice?

Data Cost Notice accepts `bytes`, `label`, `lighter`, `direction`, `verb`. Configures mobile data, data saver, wifi only behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of data-cost-notice?

The Network Information API is not available in every browser (notably Safari and Firefox); without it, pass connection details yourself. Chrome caps reported bandwidth at 10 Mbps, so times are rough and fast lines aren't called slow. "Wait for Wi-Fi" relies on the browser reporting the connection type Server requirement: backend verification for data-cost-notice.

How does Data Cost Notice meet accessibility guidelines?

Notice content is a role="status" region. Version choices are a labelled role="group" of buttons. The waiting pulse only animates when motion is allowed. Minimizes errors: download used all mobile data, autoplay ate data.

Which components pair with Data Cost Notice?