Skip to content

Time Slots

The times of one day to pick from, for booking a call. They are made on the host's clock and shown in the viewer's time zone, with the zone named under the list. Booked and past times stay in the list, disabled. Intl only, no date library.

On this page
Used for
  • Book a demo
  • Pick a review slot
  • Schedule an agent run
  • Office hours

Examples

Viewer is in

Installation

npx knowns-ui@latest add time-slots
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

slots
{ start: Date; end: Date; disabled?: boolean; note?: string }[]
The day's slots in order. Make them with buildSlots, or map your API's.
value / defaultValue / onValueChange
Date | null (the slot's start) / (slot) => void
Defaultnull
The selected slot. onValueChange gets the whole slot.
onConfirm / confirmLabel
(slot) => void / string
Default - / "Confirm"
Shows a Confirm button next to the selected slot. Leave it out for a plain picker.
timeZone / locale / hourCycle
string / string / "12" | "24"
Defaultviewer's / browser / locale
The zone the times are written in, an IANA id. The label under the list names it and its offset.
showZone / label / empty
boolean / string / ReactNode
Defaulttrue / "Available times" / ...
The zone line, the list's name for screen readers, and what shows with no slots.
buildSlots(options)
{ day, timeZone, from, to, step, duration, busy, notBefore }
A day of slots on the host's clock. Busy and past slots come back disabled with the note Booked or Past. Clock changes are handled: the missing hour has no slots.

Keyboard: Tab to the list, Up and Down move between free times (booked ones are skipped), Home and End jump to the ends, Enter or Space picks, and Tab moves on to Confirm. Picking fades Confirm in for 120ms; reduced motion shows it at once. Pair it with Calendar to choose the day first.

What it handles

  1. 01Lists the bookable times of one day as a listbox of options, formatted in a chosen IANA time zone with hourCycle 12 or 24.
  2. 02Builds the day with buildSlots from working hours, a step, a duration and busy intervals, marking overlapping slots Booked and earlier ones Past through notBefore.
  3. 03Keeps one tab stop, on the selected slot or the first free one, and moves with ArrowUp, ArrowDown, Home and End across the free slots only.
  4. 04Strikes through disabled slots and shows their note, so a booked time reads as taken instead of disappearing.
  5. 05Shows a Confirm button next to the selected slot when onConfirm is passed, with confirmLabel to change its words.
  6. 06Writes the zone under the list ("Times in Ho Chi Minh (GMT+7)") so a viewer in another zone knows what they are reading, and follows clock changes.

States

First render
Nothing. The list paints as it is, with no Confirm animation
none
Slot hover
The slot background and border change
120ms, ease out
Slot selected
The slot gets a dark border and a soft fill
none, at once
Confirm appears
The Confirm button fades in beside the chosen slot
120ms, opacity only
Reduced motion
Confirm appears at once
0ms

Works with

When to use

When to use

  • Booking a call or a demo: the times of one day, shown in the viewer's time zone.
  • Any list of start times where some are taken.

When not to use

  • Picking the day: pair it with the calendar: use Calendar.
  • A time typed into a form: use Date Picker.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Time Slots to my app and wire it to my own data.
  • I need booking a call or a demo: the times of one day, shown in the viewer's time zone. Set that up with the Knowns UI Time Slots.
  • Which Time Slots props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "time-slots" }) and search_docs({ query: "time slots" }).

Need help?

Stuck on Time Slots, or found something off? We read every message.