# Time-slot picker

- **[App UI](/app/)**
- **[Scheduling](/app/scheduling/)**
- **Time-slot picker**

Pick a time: days across, times down, as a keyboard grid (arrow keys, Home and End, Space picks).

## Notes

- **When to use it**: A grid of days and times where the person picks one slot and confirms it. For a read-only overview of a month, use `app-scheduling-calendar` instead; this block exists for choosing, and it never submits anything itself.
- **Writing for it**: - List the times once in times (2 to 8, 10 characters each) and mark the full ones per day in that day's unavailable list. A time you mention there must also exist in times.
- selected starts the grid on a slot using the exact day label and time. Day labels hold 20 characters, so 'Tue 17 Nov' fits but a full date sentence does not.
- The help line (160) is shown under the grid. Say what the keys do, and keep fullLabel to one word because a taken slot gets it in its accessible name.
- **Watch out for**: With more than five days the grid gets wider and scrolls sideways, and scrollHint is only shown then. A selected slot that is marked unavailable is ignored, so the grid starts with nothing chosen.

## Pairs well with

- **[App, step wizard header](/blocks/app/onboarding-steps)**
- **[App, month calendar](/blocks/app/scheduling-calendar)**
- **[App, search results](/blocks/app/search-results)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppSchedulingSlots from '@/components/klarhimmel/blocks/app-scheduling-slots';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppSchedulingSlots props={{
          "eyebrow": "Name the service owner",
          "title": "Say what the person is choosing a time for",
          "description": "Say how long it takes and until when it can be changed.",
          "legend": "Available times",
          "help": "Say which keys move between times and which one picks.",
          "days": [
            {
              "label": "Day one",
              "unavailable": [
                "09:00",
                "10:00"
              ]
            },
            {
              "label": "Day two",
              "unavailable": []
            }
          ],
          "times": [
            "09:00",
            "10:00"
          ],
          "selected": {
            "day": "Day two",
            "time": "10:00"
          },
          "scrollHint": "Say there are more days to the side.",
          "fullLabel": "Full",
          "summary": "Selected",
          "none": "Say nothing is chosen yet",
          "at": "at",
          "confirm": "Confirm booking",
          "change": "Change booking",
          "state": "idle",
          "messages": {
            "error": "Say to choose a time first.",
            "confirmed": "Say it is booked and where the confirmation goes.",
            "empty": "Say no times are free and what to try next.",
            "taken": "Say that time is taken and to choose another."
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

Days (each with the times already taken) and times are the grid; selected is where it starts. The labels say what a taken slot is and what is chosen; state sets error, confirmed or empty.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **legend**: Text, up to 60 characters.
- **help**: Text, up to 160 characters.
- **days**: List of 2 to 7. Each item: label, unavailable.
- **times**: List of 2 to 8.
- **selected**: Fields: day, time. Optional; empty is not rendered.
- **scrollHint**: Text, up to 60 characters.
- **fullLabel**: Text, up to 20 characters.
- **summary**: Text, up to 40 characters.
- **none**: Text, up to 60 characters.
- **at**: Text, up to 10 characters.
- **confirm**: Text, up to 30 characters.
- **change**: Text, up to 30 characters.
- **state**: One of 'idle', 'error', 'confirmed', 'empty'.
- **messages**: Fields: error, confirmed, empty, taken.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-scheduling-slots
  ```

Uses

- Button

- **About**: Pick a time: days across, times down, as a keyboard grid (arrow keys, Home and End, Space picks). A taken slot says so in words, the choice is repeated in a status line, and idle, error, confirmed and empty states. Never submits.
- **States**: Idle, error, confirmed, empty. A keyboard grid: arrows, Home and End, Space. Taken slots say so in words. New project? Set it up once: /get-started/installation.
