Skip to content

DatePicker

<bh-datepicker> | BharatDatePicker

The DatePicker component provides an intuitive way to select dates with a calendar interface. It supports various customization options including different sizes, styles, and date formats.

Basic Usage

Variants

The DatePicker component supports different visual styles to match your application’s design.

Default

Pill

Sizes

The DatePicker component comes in three different sizes.

Labels and Hints

You can add labels and hints to provide additional context for the DatePicker.

Date Constraints

You can set minimum and maximum dates to restrict the date selection range.

Custom Date Formats

You can customize the date format according to your requirements.

Properties

PropertyTypeDescription
currentMonthnumberCurrent month displayed in the calendar (0-11)
currentYearnumberCurrent year displayed in the calendar
formatstringFormat for displaying the selected date (supported: yyyy-mm-dd, dd/mm/yyyy, mm-dd-yyyy)
hintstringHint text displayed below the datepicker
labelstringLabel text for the datepicker
labelColorstringColor of the label text
labelPositionstringPosition of the label (top, left)
labelSizestringFont size of the label
maxDatestringMaximum selectable date in yyyy-mm-dd format
minDatestringMinimum selectable date in yyyy-mm-dd format
outlinebooleanWhether to display the datepicker with an outline style
pillbooleanWhether to display the datepicker with rounded corners
placeholderstringPlaceholder text when no date is selected
selectedDateObjectJavaScript Date object for the currently selected date
showCalendarbooleanWhether the calendar dropdown is visible
sizestringSize of the datepicker (small, medium, large)
valuestringThe selected date value in the specified format
variantstringVisual style variant (default, gradient, tricolor)