Socket
Book a DemoInstallSign in
Socket

@dropdown-datepicker/react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dropdown-datepicker/react

A fully customizable dropdown datepicker component for React, built on top of @dropdown-datepicker/core. Offers separate dropdowns for day, month, and year with complete control over styling and behavior.

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

@dropdown-datepicker/react

A fully customizable dropdown-based date picker component for React, built on top of @dropdown-datepicker/core.

This component provides a highly flexible way to select dates using separate dropdowns for day, month, and year. Perfect for forms, age input, or anywhere a full calendar is overkill.

✨ Features

  • Separate dropdowns for day, month, and year
  • Customizable formats, labels, order, and styling
  • Age-based limits (minAge, maxAge)
  • Locale support and label customization
  • Min/max date constraints
  • Purely functional and easy to style

📦 Installation

npm install @dropdown-datepicker/react
# or
pnpm add @dropdown-datepicker/react

🧠 Usage

import React from "react";
import DropdownDatepicker from "@dropdown-datepicker/react";

function Example() {
    return (
        <DropdownDatepicker
            initialDate={new Date("2000-01-01")}
            onChange={(date) => console.log("Selected date:", date)}
            yearRange={[1950, 2025]}
            dateOrder={["day", "month", "year"]}
            monthFormat="short"
            allowPast={true}
            allowFuture={false}
            minAge={18}
            containerClassName="flex gap-2"
            selectClassName="border px-2 py-1 rounded"
            labelMap={{ day: "Day", month: "Month", year: "Year" }}
            showLabel={true}
        />
    );
}

🧩 Props

PropTypeDescription
initialDateDateThe starting selected date.
onChange(date: Date) => voidCallback when full date is selected.
onDayChange(day: number) => voidCallback for day dropdown change.
onMonthChange(month: number) => voidCallback for month dropdown change.
onYearChange(year: number) => voidCallback for year dropdown change.
yearRange[number, number]Min and max year range for the year dropdown. Default: [1900, currentYear].
dayFormat"number" | "ordinal"Format for day values. "ordinal" = "1st", "2nd", etc.
monthFormat"long" | "short" | "number"Format for month values.
dateOrder["day", "month", "year"]The order of the dropdowns. You can rearrange to any combination.
minDateDateMinimum date allowed.
maxDateDateMaximum date allowed.
allowFuturebooleanAllow selecting future dates. Default: true.
allowPastbooleanAllow selecting past dates. Default: true.
sortYears"asc" | "desc"Whether to sort year dropdown ascending or descending.
minAgenumberMinimum age required (calculated from today).
maxAgenumberMaximum age allowed (calculated from today).
containerClassNamestringClass name for the container wrapping all dropdowns.
selectClassNamestringClass name for each <select> element.
optionClassNamestringClass name for each <option>.
showLabelbooleanWhether to show a label before each dropdown.
labelClassNamestringClass name for each label element.
labelMap{ day?: string, month?: string, year?: string }Custom labels for each dropdown.
requiredbooleanAdd required attribute to selects.
localestringLocale used for month names and formatting. (e.g. "en", "fr", "bn")

🌍 Locale Support

Pass the locale:

<DropdownDatepicker locale="fr" />

📸 Screenshot / Demo

Coming soon! You can build a quick demo in Storybook or CodeSandbox using the example above.

🐛 Issues

Report bugs or suggest features here:
👉 Open React Issues

📄 License

MIT – © Your Name

Keywords

datepicker

FAQs

Package last updated on 16 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.