Studio booking
Name a session, pick an available date and time, and edit the reservation.
Installation
Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/event-planner.json
Usage
import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/event-planner"
export default function App() {
return (
<Cyber>
<Recipe />
</Cyber>
)
}
Source
"use client"
import { useState } from "react"
import { CalendarCheck } from "lucide-react"
import { Button } from "@/components/ui/button"
import { DatePicker } from "@/components/ui/date-picker"
import { SegmentedControl } from "@/components/ui/segmented-control"
import { TextField } from "@/components/ui/text-field"
import "./recipe-layout.css"
type Booking = { title: string; date: string; time: string }
function localDate() {
const date = new Date()
return [date.getFullYear(), String(date.getMonth() + 1).padStart(2, "0"), String(date.getDate()).padStart(2, "0")].join("-")
}
export default function EventPlanner() {
const [today] = useState(localDate)
const [title, setTitle] = useState("Listening session")
const [date, setDate] = useState(today)
const [time, setTime] = useState("14:00")
const [booking, setBooking] = useState<Booking | null>(null)
return (
<form className="sink-stack" onSubmit={event => {
event.preventDefault()
if (booking) setBooking(null)
else if (title.trim() && date) setBooking({ title: title.trim(), date, time })
}}>
{booking ? (
<>
<div className="sink-row"><CalendarCheck size={28} color="var(--cy-signal)" aria-hidden /><strong>Studio reserved</strong></div>
<div role="status"><strong>{booking.title}</strong><p className="sink-note">
{new Date(booking.date + "T12:00:00").toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })}
{" · "}{booking.time} · Studio B
</p></div>
</>
) : (
<>
<TextField label="Session name" value={title} onValueChange={setTitle} required maxLength={80} />
<DatePicker label="Studio date" required min={today} value={date}
onValueChange={value => setDate(typeof value === "string" ? value : "")} />
<SegmentedControl label="Start time" value={time} onValueChange={next => next && setTime(next)}
options={["10:00", "14:00", "18:00"]} fill />
</>
)}
<Button size="sm" tone="signal" type="submit" disabled={!title.trim() || !date}>{booking ? "Edit reservation" : "Reserve Studio B"}</Button>
</form>
)
}
Components in this recipe
- Date picker — A date field with a calendar that opens beside it.
- Text field — A labelled text input in a cut frame, with a hint, an error and an optional icon.
- Segmented control — A row of segments with an indicator that slides to the choice.