logo
DocsCalendar

Calendar Component

The Calendar component is the core UI for rendering and selecting Bikram Sambat dates.

Basic Usage

import { Calendar } from 'nepali-bs-calendar-react'
 
export function Demo() {
  return <Calendar />
}
Preview

Interactive Demo

Baisakh 2076
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 TSXimport { Calendar } from 'nepali-bs-calendar-react'

export default function Demo() {
  return <Calendar onChange={(date) => console.log(date)} />
}

Props

PropTypeDefaultDescription
valueNepaliDateValueundefinedControlled selected date.
defaultValueNepaliDateValueundefinedInitial selected date.
onChange(value) => voidundefinedCalled when a user selects a date.
classNamestringundefinedCustom wrapper class.
disabledbooleanfalseDisable interaction.
minDatestringundefinedMinimum selectable BS date.
maxDatestringundefinedMaximum selectable BS date.

Events

Use onChange to capture the selected date.

<Calendar onChange={(value) => console.log('Selected date:', value)} />

Examples

Controlled calendar

'use client'
 
import { useState } from 'react'
import { Calendar } from 'nepali-bs-calendar-react'
 
export function ControlledCalendar() {
  const [date, setDate] = useState('2083-02-14')
  return <Calendar value={date} onChange={setDate} />
}

Date range guard

<Calendar minDate="2083-01-01" maxDate="2083-12-30" />