2.2.0 • Published 7 months ago

@mohsensami/persian-datepicker v2.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

@mohsensami/persian-datepicker

A beautiful and customizable Persian (Jalali) DatePicker component for React applications.

Features

  • 🎯 Easy to use and integrate
  • 📅 Full Persian (Jalali) calendar support
  • 🎨 Customizable styling
  • 📱 Responsive design
  • ⚡️ Built with TypeScript
  • 🔒 Date range validation
  • 🌐 RTL support

Installation

npm install @mohsensami/persian-datepicker
# or
yarn add @mohsensami/persian-datepicker

Usage

import { useState } from "react";
import PersianDatePicker from "@mohsensami/persian-datepicker";

const MyComponent = () => {
  const [selectedDate, setSelectedDate] = useState<Date | null>(null);

  return (
    <PersianDatePicker
      value={selectedDate}
      onChange={(date) => setSelectedDate(date)}
      placeholder="تاریخ را انتخاب کنید"
      minDate="2023-01-01"
      maxDate="2025-12-31"
    />
  );
};

Props

PropTypeDefaultDescription
valueDate \| string \| null-The selected date value
onChange(date: Date) => void-Callback when date changes
classNamestring""Additional class for the container
placeholderstring"تاریخ را انتخاب کنید"Input placeholder text
inputClassstring""Additional class for the input
calendarClassstring""Additional class for the calendar
disabledbooleanfalseDisable the date picker
minDateDate \| string-Minimum selectable date
maxDateDate \| string-Maximum selectable date
showTodayButtonbooleantrueShow/hide today button
todayButtonTextstring"امروز"Text for today button

Styling

The component comes with default styles, but you can customize it using the provided class names:

  • .persian-date-picker - Main container
  • .date-input - Input field
  • .calendar - Calendar container
  • .calendar-header - Calendar header
  • .calendar-backdrop - Backdrop when calendar is open

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build the package
npm run build

License

MIT © Mohsen Sami

2.2.0

7 months ago

2.1.0

7 months ago

2.0.2

7 months ago

2.0.1

7 months ago

2.0.0

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago