0.1.1 • Published 2 years ago

@react-shamsi/calendar v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Jalali calendar

Let's start by displaying a very simple Jalali calendar using react-shamsi. We do it by import the styles and the component itself like so:

import { Calendar } from "@react-shamsi/calendar";
import "@react-shamsi/calendar/dist/styles.css";

export default function Example() {
  return <Calendar />;
}

Configuration

Now we are going to explore every single prop that could be passed to Calendar.

Prop nameDescriptionDefault value
highlightTodayHighlights the current day that is displayed in the calendar.true
onChangeFunction that is called when the user selects a daten/a
activeDateControls the active date in the calendarn/a
defaultActiveDateSets the default date in the calendar without explicitly controlling it.n/a
themeCustomizes how the calendar looks. Has 3 pre-built themes that are dark, darkRed and light and also could have a completely customized theme. For more information on how to customize the calendar's appearance, please visit the following section.light
showGoToTodayWhen enabled, it shows the go to today button which is written as: برو به امروزtrue
minDateWhen you pass a date to this prop, the user can't select any date older than the minDate.n/a
maxDateWhen you pass a date to this prop, the user can't select any date newer than the maxDate.n/a
disabledDatesWhen a list of dates is passed to this prop, those dates will become unselectable[]
showFooterControls whether or not the footer should be showntrue
disableTransitionsWhen set to true, it disables all the transitions across the calendar.false
bodyTransitionCan be set to either of these options: zoomIn, zoomOut and fadezoomIn
showFridaysAsRedWhen set to true, any friday appearing on the calendar will appear as red/selected color in the theme.true
monthsNames of the 12 months as an array."فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند",
onConfirmFunction that gets called when the user clicks the confirm buttonn/a
onCancelFunction that gets called when the user clicks the cancel buttonn/a