Stay Length

Stay Length is a copy-paste React component that stops booked one night too few 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/stay-length
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

StopsBooked one night too few

Was this component page useful?

How do I install Stay Length?

pnpm dlx shadcn@latest add @bollard/stay-length

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

How do I use Stay Length in React?

stay-length-usage.tsx
import { StayLength } from "@/components/ui/stay-length"

<StayLength defaultValue={{ start: "2026-11-02", end: "2026-11-08" }} />

What input mistakes does Stay Length catch?

  • End date before start date
  • Nights versus days confusion against the expected count
  • A check-out date entered as the last night
  • Weekend days and holidays inside the range (for leave)

What props does Stay Length accept?

StayLength props
PropTypeDefault
mode

"stay" counts nights between check-in and check-out; "leave" counts the days off, both inclusive.

"stay" | "leave""stay"
value

Controlled range.

DateRange—
defaultValue

Initial range when uncontrolled.

DateRange{ start: "", end: "" }
onValueChange

Called with the date range after every change.

(range: DateRange) => void—
expected

The length the person asked for elsewhere ("7 nights" in search), to catch an off-by-one.

number—
weekend

Week days that aren't working days, 0 = Sunday.

number[][0, 6]
holidays

Public holidays, from your calendar source.

Holiday[][]
locale

Locale for date formatting.

string"en-GB"
startLabel

Label of the start date.

stringmode === "stay" ? "Check-in" : "First day off"
endLabel

Label of the end date.

stringmode === "stay" ? "Check-out" : "Last day off"
messages

Overrides any of the sentences in `STAY_LENGTH_MESSAGES`, e.g. to translate them.

Partial<StayLengthMessages>—

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

How is Stay Length accessible?

  • Start and end inputs have <label>s; aria-invalid on errors
  • Readback in a polite live region via aria-describedby; errors use role=alert
  • Fix and keep are labelled buttons

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

What are the limitations and server boundaries?

  • Works on calendar dates only, never times
  • Holidays are yours to pass; weekend days default to Saturday–Sunday unless you set weekend

What expensive mistakes does Stay Length stop?

Booked one night too few

Also known as

date range · check-in check-out · hotel booking · leave request · nights · holidays · date picker · oyo

Field type

What dependencies does Stay Length require?

Stay Length facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameStay Length
Registry identifier@bollard/stay-length
Install commandnpx shadcn@latest add @bollard/stay-length
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 Stay Length

How does Stay Length validate Indian financial identifiers?

Stay Length stops booked one night too few. Complies with national standards for End date before start date, Nights versus days confusion against the expected count, A check-out date entered as the last night, Weekend days and holidays inside the range (for leave). Limitation: verify stay-length with issuer gateway.

How do I install stay-length with shadcn?

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

What props customize Stay Length?

Stay Length accepts `mode`, `value`, `defaultValue`, `onValueChange`, `expected`. Configures date range, check-in check-out, hotel booking behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of stay-length?

Works on calendar dates only, never times. Holidays are yours to pass; weekend days default to Saturday–Sunday unless you set weekend Server requirement: backend verification for stay-length.

How does Stay Length meet accessibility guidelines?

Start and end inputs have <label>s; aria-invalid on errors. Readback in a polite live region via aria-describedby; errors use role=alert. Fix and keep are labelled buttons. Minimizes errors: nights vs days confusion, checkout date off by one.

Which components pair with Stay Length?