npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

veda-react-datepicker

v3.0.5

Published

A modern, customizable date picker component for React with range selection

Readme

Veda React DatePicker

A modern, accessible, and customizable date picker component for React applications with single date and range selection support.

npm version npm downloads License TypeScript Bundle Size

Features

  • 🎨 Modern and minimalist design
  • 📅 Single date and date range selection
  • 🎯 Full TypeScript support
  • 📱 Responsive design with mobile optimization
  • ⌨️ Keyboard navigation and accessibility
  • 🎊 Smooth animations and transitions
  • 🎭 Comprehensive theme customization
  • 🔄 Month/year quick selection
  • ⚡ Date shortcuts support
  • 📝 Optional text input support
  • 🔒 Min/max date constraints
  • ⚛️ Controlled & uncontrolled modes

Installation

npm install veda-react-datepicker
# or
yarn add veda-react-datepicker

Basic Usage

JavaScript

import { DatePicker } from 'veda-react-datepicker';

// Single Date Selection
function SingleDateExample() {
  return (
    <DatePicker
      onChange={(date) => console.log(date)}
      placeholder="Select date"
    />
  );
}

// Date Range Selection
function DateRangeExample() {
  return (
    <DatePicker
      mode="range"
      onChange={(range) => console.log(range)}
      placeholder="Select date range"
    />
  );
}

TypeScript

import { DatePicker } from 'veda-react-datepicker';
import type { DateRange } from 'veda-react-datepicker';

// Single Date Selection
function SingleDateExample() {
  const handleChange = (date: Date | null) => {
    console.log(date);
  };

  return (
    <DatePicker
      onChange={handleChange}
      placeholder="Select date"
    />
  );
}

// Date Range Selection
function DateRangeExample() {
  const handleChange = (range: DateRange | null) => {
    console.log(range?.startDate, range?.endDate);
  };

  return (
    <DatePicker
      mode="range"
      onChange={handleChange}
      placeholder="Select date range"
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | Date \| DateRange \| null | - | Controlled value | | defaultValue | Date \| DateRange | - | Initial uncontrolled value | | onChange | (value: Date \| DateRange \| null) => void | - | Change callback | | mode | 'single' \| 'range' | 'single' | Selection mode | | minDate | Date | - | Minimum selectable date | | maxDate | Date | - | Maximum selectable date | | placeholder | string | "Select date" | Input placeholder | | dateFormat | DateFormat | "MM/DD/YYYY" | Date display format | | disabled | boolean | false | Disable the picker | | allowInput | boolean | true | Allow manual text input | | shortcuts | Shortcut[] | [] | Quick selection shortcuts | | theme | ThemeConfig | - | Theme customization | | as | ElementType | 'div' | Container component | | input | ElementType | - | Custom input component | | className | string | "" | Additional CSS class | | containerProps | object | {} | Container props | | inputProps | object | {} | Input props | | parseDate | (value: string) => Date \| null | - | Custom date parser |

Advanced Examples

Date Range with Shortcuts

import { DatePicker } from 'veda-react-datepicker';
import type { Shortcut } from 'veda-react-datepicker';

function RangeWithShortcuts() {
  const shortcuts: Shortcut[] = [
    {
      label: 'Last 7 Days',
      value: () => {
        const end = new Date();
        const start = new Date();
        start.setDate(start.getDate() - 6);
        return { startDate: start, endDate: end };
      }
    },
    {
      label: 'This Month',
      value: () => {
        const now = new Date();
        const start = new Date(now.getFullYear(), now.getMonth(), 1);
        const end = new Date(now.getFullYear(), now.getMonth() + 1, 0);
        return { startDate: start, endDate: end };
      }
    }
  ];

  return (
    <DatePicker
      mode="range"
      shortcuts={shortcuts}
      onChange={(range) => console.log(range)}
    />
  );
}

Custom Theme

import { DatePicker } from 'veda-react-datepicker';
import type { ThemeConfig } from 'veda-react-datepicker';

function ThemedDatePicker() {
  const theme: ThemeConfig = {
    colors: {
      primary: '#4F46E5',
      hover: '#4338CA',
      text: '#1F2937',
      border: '#E5E7EB',
      background: '#F9FAFB',
      selected: '#4F46E5',
      range: 'rgba(79, 70, 229, 0.1)',
      rangeHover: 'rgba(79, 70, 229, 0.07)'
    },
    borderRadius: '8px',
    fontSize: '0.875rem'
  };

  return (
    <DatePicker
      onChange={(date) => console.log(date)}
      theme={theme}
    />
  );
}

Custom Input Component

import { DatePicker } from 'veda-react-datepicker';
import { Calendar } from 'lucide-react';

const CustomInput = React.forwardRef<
  HTMLInputElement,
  React.InputHTMLAttributes<HTMLInputElement>
>(({ value, onChange, ...props }, ref) => (
  <div className="custom-input-wrapper">
    <input
      ref={ref}
      value={value}
      onChange={onChange}
      className="custom-input"
      {...props}
    />
    <Calendar className="calendar-icon" size={18} />
  </div>
));

function CustomInputExample() {
  return (
    <DatePicker
      input={CustomInput}
      inputProps={{
        className: 'my-custom-input',
        'aria-label': 'Select date'
      }}
    />
  );
}

TypeScript Support

The package includes comprehensive TypeScript definitions. Key types:

type DateFormat = 
  | 'YYYY-MM-DD' 
  | 'YYYY/MM/DD' 
  | 'YYYY.MM.DD'
  | 'DD-MM-YYYY'
  | 'DD/MM/YYYY'
  | 'DD.MM.YYYY'
  | 'MM-DD-YYYY'
  | 'MM/DD/YYYY'
  | 'MM.DD.YYYY';

interface DateRange {
  startDate: Date | null;
  endDate: Date | null;
}

interface ThemeConfig {
  colors?: {
    primary?: string;
    hover?: string;
    background?: string;
    text?: string;
    border?: string;
    selected?: string;
    range?: string;
    rangeHover?: string;
  };
  borderRadius?: string;
  fontSize?: string;
}

interface Shortcut {
  label: string;
  value: Date | DateRange | (() => Date | DateRange);
}

License

MIT © Latiful Mousom