Docs
Installation

Installation

Install for any React based project.

Install the package

npm i @bryanberger/datepicker

Compose a calendar

Here is an example of a simple calendar styled with Tailwind CSS:

January 2024
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
28293031123
import { Calendar } from '@bryanberger/datepicker';
import { ChevronLeft, ChevronRight } from 'lucide-react';
 
const MyDatePicker = () => {
 
	const today = new Date();
 
	return (
		<Calendar
			className="border rounded-md p-3"
			defaultSelected={ today }
		>
			<Calendar.Header className="!justify-between !w-full pl-2">
				<Calendar.Title />
				<div className="space-x-1 flex items-center">
					<Calendar.NavButton direction="previous">
						<ChevronLeft />
					</Calendar.NavButton>
					<Calendar.NavButton direction="next" >
						<ChevronRight />
					</Calendar.NavButton>
				</div>
			</Calendar.Header>
			<Calendar.Content>
				<Calendar.Head />
				<Calendar.Grid
					classNames={ { day: 'h-9 w-9 text-center data-[is-selected=true]:bg-slate-900 data-[is-first=true]:rounded-l-md data-[is-last=true]:rounded-r-md' } }
				/>
			</Calendar.Content>
		</Calendar>
	);
};
 
export default MyDatePicker;