# Availability Editor

> A weekly hours editor in the Cal.com mould: each day switches on and off and holds one or more time ranges, with inline errors for empty or overlapping ones and a popover that copies a day's hours to the days you tick. A week strip charts the hours on offer with a weekly total, and date overrides picked in a calendar dialog replace a day's hours or block it.

- Slug: `availability-editor`
- Category: [Calendars](https://www.assembli.design/category/calendars.md)
- Type: component
- Tags: availability, schedule, working-hours, scheduling, time-ranges, booking
- npm dependencies: @base-ui/react, lucide-react
- shadcn/ui dependencies: none
- Live preview: https://www.assembli.design/preview/availability-editor
- Page: https://www.assembli.design/components/availability-editor

![Availability Editor preview](https://www.assembli.design/thumbnails/availability-editor-light.png)

## Props

Other props pass through to the root element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `Availability` |  |  |
| `defaultValue` | `Availability` | `DEFAULT_AVAILABILITY` |  |
| `onChange` | `(value: Availability, valid: boolean) => void` |  | `valid` is false while any day has an empty or overlapping range. |
| `step` | `number` | `15` | Minutes between the times on offer. |
| `weekStart` | `0 \| 1 \| 6` | `1` | 0 Sunday, 1 Monday, 6 Saturday. |
| `hourCycle` | `"h12" \| "h23"` | `"h12"` |  |
| `locale` | `string` | `"en-US"` |  |
| `now` | `string \| number \| Date` |  | Today, so overrides can't be set in the past. Pass it so server and browser agree. |
| `container` | `HTMLElement \| null` |  | Renders overlays inside this element instead of the body. |
| `title` | `React.ReactNode` | `"Working hours"` |  |
| `description` | `React.ReactNode` | `"When people can book time with you. Bookings never land ou…` |  |

## Install

One-time setup (needs a subscription):

1. Add the registry to the project's `components.json`: `{"@assembli":{"url":"https://www.assembli.design/r/{name}.json","headers":{"Authorization":"Bearer ${ASSEMBLI_API_KEY}"}}}` (merge into `"registries"`).
2. Put an API key from https://www.assembli.design/account in `.env.local` as `ASSEMBLI_API_KEY=asm_…`.

Then install with the shadcn CLI (writes `components/availability-editor/availability-editor.tsx` and installs dependencies):

```bash
npx shadcn@latest add @assembli/availability-editor
```

Registry item JSON: https://www.assembli.design/r/availability-editor.json (send `Authorization: Bearer <api key>`)

## Code

> Component source needs an Assembli subscription ($12/month or $96/year) and an API key sent as `Authorization: Bearer <key>`. To get one without copying anything, POST https://www.assembli.design/api/agent/login (or call the MCP tool connect_account), show the user the link it returns, and poll https://www.assembli.design/api/agent/token for the key. Or subscribe at https://www.assembli.design/pricing and create a key at https://www.assembli.design/account.
