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.
- Book a demo
- Pick a review slot
- Schedule an agent run
- Office hours
Examples
Installation
npx knowns-ui@latest add time-slotsPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Time slots from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/time-slots
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add time-slots
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/calendar/calendar.tsx
- components/ui/knowns/calendar/calendar-utils.ts
- components/ui/knowns/calendar/calendar-zone.ts
- components/ui/knowns/time-slots/time-slots.tsx
- components/ui/knowns/time-slots/slots.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/time-slots, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "time-slots" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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- Default
null - 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"- Default
viewer'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- Default
true / "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.
| Prop | Type | Default | Description |
|---|---|---|---|
| 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 | null | The selected slot. onValueChange gets the whole slot. |
| onConfirm / confirmLabel | (slot) => void / string | - / "Confirm" | Shows a Confirm button next to the selected slot. Leave it out for a plain picker. |
| timeZone / locale / hourCycle | string / string / "12" | "24" | viewer'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 | true / "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
- 01Lists the bookable times of one day as a listbox of options, formatted in a chosen IANA time zone with hourCycle 12 or 24.
- 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.
- 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.
- 04Strikes through disabled slots and shows their note, so a booked time reads as taken instead of disappearing.
- 05Shows a Confirm button next to the selected slot when onConfirm is passed, with confirmLabel to change its words.
- 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
| State | What moves | Timing |
|---|---|---|
| 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" }).