Skip to content

Seat & Group Bookings

Seat bookings enable event types with multiple attendees per time slot — yoga classes, workshops, group sessions.

import { computeSeatAvailability, isGroupEvent } from "@thebookingkit/core";
// Check if an event type supports group bookings
isGroupEvent({ maxSeats: 20 }); // true
isGroupEvent({ maxSeats: 1 }); // false
// Compute remaining capacity
const availability = computeSeatAvailability(
20, // maxSeats
existingAttendees // SeatAttendee[]
);
// Returns: SeatAvailability
// { maxSeats: 20, bookedSeats: 12, availableSeats: 8, isFull: false }
import { canReserveSeat, validateSeatReservation, SeatError } from "@thebookingkit/core";
// Quick check
canReserveSeat(20, existingAttendees, 3); // true if 3+ seats remain
// Full validation (throws SeatError if invalid)
validateSeatReservation(
20, // maxSeats
existingAttendees, // current attendees
"attendee@example.com" // attendee email to validate
);
import { computeGroupEventSummary, formatSeatCount } from "@thebookingkit/core";
const summary = computeGroupEventSummary(
"booking-123", // bookingId
new Date("2026-03-10T14:00:00Z"), // startsAt
new Date("2026-03-10T15:00:00Z"), // endsAt
20, // maxSeats
existingAttendees // attendees
);
// Returns: GroupEventSummary
// { bookingId, startsAt, endsAt, maxSeats, attendees, confirmedCount, cancelledCount }
formatSeatCount(8, 20); // "8 / 20 seats booked"
import { SeatsPicker } from "./components/seats-picker";
<SeatsPicker
maxSeats={availability.remainingSeats}
selectedSeats={seatCount}
onSeatsChange={setSeatCount}
pricePerSeat={eventType.priceCents}
/>