Skip to content
Haze UI

Time slot picker

Bookable times for one day as a grid of radio buttons, grouped by part of the day, with taken slots shown but disabled.

pnpm dlx shadcn@latest add @haze/time-slot-picker
Open preview in a new tab
Liveno JavaScript

When to use

  • A customer books an appointment, a table or a call for a chosen day
  • Availability comes in fixed slots of known length

When not to use

  • Any time can be typed in freely. Use time-picker.
  • The customer first has to choose the day. Put calendar above this picker.

Installation

Add the Haze registry to components.json once, then install Time slot picker with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/time-slot-picker
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Base for every radio id and the description id.
namestringidForm field name of the radios.
legendstring"Tuesday, 25 November"Visible question, usually the day.
descriptionstring–Helper line: service, staff member, duration.
groups{ label: string; slots: { time: string; value?: string; available?: boolean }[] }[]–Parts of the day with their slots.
valuestring"10:30"Value checked on load.
takenLabelstring"taken"Word read after a disabled slot.
requiredbooleantrueMakes choosing a slot required.
classstring–Additional classes on the fieldset.

Keyboard interactions

Tab
Move into the slots.
Arrow keys
Choose the next or previous free slot.

Accessibility

  • Slots are native radios in a fieldset, so arrow keys move between them and the form submits the chosen time.
  • A taken slot is disabled, struck through and read as taken; the chosen slot gets a check mark as well as a color.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Time slot picker" with `npx shadcn@latest add @haze/time-slot-picker`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import TimeSlotPicker from "@/components/haze/ui/time-slot-picker.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/time-slot-picker.md

  • Customize with real content

    Adapt the Haze time-slot-picker ui for our product. Replace the demo values of these props with our real content: id, name, legend, description, groups, value, takenLabel, required, class. Keep the layout, the heading level rules and these accessibility details: Slots are native radios in a fieldset, so arrow keys move between them and the form submits the chosen time. A taken slot is disabled, struck through and read as taken; the chosen slot gets a check mark as well as a color. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using time-slot-picker, check it fits: use it when a customer books an appointment, a table or a call for a chosen day; availability comes in fixed slots of known length. Avoid it when any time can be typed in freely. use time-picker.; the customer first has to choose the day. put calendar above this picker.. Alternatives: @haze/time-picker, @haze/calendar, @haze/choice-card.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog