Availability
Open in

Availability Designer

A weekly schedule component for managing availability time slots. Supports creation by click or drag, resizing, and drag-and-drop across days. Includes touch support and disabled/unavailable regions.

Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
7:00
8:00
9:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00

09:00

3h

12:00

14:00

2h

16:00

10:00

1.5h

11:30

* Striped regions indicate disabled times (e.g. lunch breaks or unavailable blocks). Events cannot be created, moved, or resized into these areas.

Reactexample.tsx
"use client"import { useState } from "react"import { Availability, type TimeSpan } from "@/registry/abui/ui/availability"export default function AvailabilityDemo() {  const [data, setData] = useState<TimeSpan[]>([    {       nanoid: "1",       week_day: 1,       start_time: "09:00",       end_time: "12:00",       active: true     },    {       nanoid: "2",       week_day: 3,       start_time: "14:00",       end_time: "16:00",       active: true     },    {       nanoid: "3",       week_day: 5,       start_time: "10:00",       end_time: "11:30",       active: true     }  ])  return (    <div className="w-full p-4 bg-background border rounded-lg">      <Availability         value={data}         onValueChange={setData}        startTime={6}        endTime={22}      />    </div>  )}

Features

  • Drag and drop time slots across days
  • Resize time slots from top or bottom
  • Optionally auto-merge adjacent time slots
  • Click and drag on empty space to create new slots
  • Disabled regions support (prevent interaction)
  • Configurable start/end times and time increments
  • Supports AM/PM or 24h format
  • Built with @dnd-kit for accessible interactions

Component Props

Availability

  • value - TimeSpan[] - Array of time slot objects
  • onValueChange - (value: TimeSpan[]) => void - Callback when slots change
  • disabled - TimeSpan[] - Array of disabled/blocked regions
  • days - number[] - Array of day indices (0-6) to display
  • timeIncrements - number - Grid interval in minutes (default: 30)
  • startTime - number - Start hour (0-23)
  • endTime - number - End hour (0-23)
  • useAmPm - boolean - Use AM/PM format instead of 24h
  • mergeAdjacent - boolean - Automatically merge adjacent blocks (default: true)