Installation
Dependencies
This component requires the following dependencies:button- shadcn/ui button componentcalendar- shadcn/ui calendar componentdialog- shadcn/ui dialog componentinput- shadcn/ui input componentlabel- shadcn/ui label componentpopover- shadcn/ui popover componentselect- shadcn/ui select componenttextarea- shadcn/ui textarea componentdate-fns- Date formatting librarylucide-react- Icon library (CalendarIcon)
Usage
Features
- Calendar picker - Full calendar component in popover for date selection
- Time picker - Select dropdown with 30-minute intervals
- Multiple inputs - Title, attendees, location, and description fields
- Date formatting - Uses date-fns for consistent date display
- Responsive grid - Date and time arranged in responsive grid layout
- Form sections - Well-organized sections with labels and helper text
- Textarea - Multi-line description input
- Bordered header - Separated header section
- Large dialog - Uses
sm:max-w-lgfor comfortable form layout - Memoized time options - Efficient time slot generation with useMemo
Component Structure
The component includes:Dialogwith controlled stateDialogTriggerbuttonDialogContentwith:- Custom padding (
p-0) - Large width (
sm:max-w-lg) - No gap (
gap-0)
- Custom padding (
- Bordered
DialogHeader - Form with multiple sections:
- Meeting title input
- Attendees input with helper text
- Grid layout (3 columns) for:
- Date picker (2 columns) with Popover and Calendar
- Time picker (1 column) with Select
- Location/conference link input
- Description textarea
- Bordered footer with:
- Cancel button (ghost variant)
- Schedule button
- State management for:
- Dialog visibility
- Selected date
- Selected time
- useMemo hook for generating time options
- date-fns format function for date display
The time picker generates options dynamically using useMemo for performance. It creates 30-minute intervals from 00:00 to 23:59. The calendar uses the Popover component to display inline when the date button is clicked.