nessra uinessra ui

A date field component that allows users to enter and edit date.

Loading...
"use client"

import * as React from "react"

Installation

pnpmnpmyarnbun
pnpm dlx shadcn@latest add https://nessra-ui.vercel.app/r/calendar.json

Usage

import { Calendar } from "@/components/ui/calendar"
const [date, setDate] = React.useState<Date | undefined>(new Date())
 
return (
  <Calendar
    mode="single"
    selected={date}
    onSelect={setDate}
    className="rounded-md border"
  />
)

Examples

Date Range

You can select a range of dates using the mode="range" prop.

Loading...
"use client"

import * as React from "react"

Multiple Months

Display multiple months using the numberOfMonths prop.

Loading...
"use client"

import * as React from "react"

With Dropdown Navigation

Use dropdowns to navigate between months and years.

Loading...
"use client"

import * as React from "react"

API Reference

Calendar

The Calendar component is built on top of React Day Picker.

PropTypeDefaultDescription
mode"single" | "multiple" | "range""single"Selection mode
selectedDate | Date[] | DateRange-The selected date(s)
onSelect(date: Date | undefined) => void-Callback when date is selected
disabledDate[] | (date: Date) => boolean-Dates to disable
numberOfMonthsnumber1Number of months to display
showOutsideDaysbooleantrueShow days from adjacent months
captionLayout"label" | "dropdown" | "dropdown-months""label"Layout of the month caption
fromYearnumber-Start year for dropdown navigation
toYearnumber-End year for dropdown navigation
defaultMonthDate-The initial month to display