Package Exports
- gs-calendar
- gs-calendar/dist/style.css
Readme
react-ad-bs-calendar
Installation
npm install react-ad-bs-calendarUsage
Here's an example of basic usage:
import Calendar from 'react-ad-bs-calendar';
function MyApp() {
return (
<div>
<Calendar />
</div>
);
}Custom styling
If you want to use default react-ad-bs-calendar styling to build upon it, you can import react-ad-bs-calendar's styles by using:
import 'react-ad-bs-calendar/dist/style.css';User guide
Calendar
Displays a calendar in AD and BS.
Props
| Prop | Default Value | Description | Example Value |
|---|---|---|---|
| mode | ModeTypeEnum.AD | Calendar mode (AD or BS) | ModeTypeEnum.AD |
| language | LanguageTypeEnum.ENGLISH | Calendar language (English or Nepali) | LanguageTypeEnum.ENGLISH |
| value | "" | Initial selected date in "YYYY-MM-DD" format | "2024-01-17" |
| onClickDate | (value, date_ad) => {} | Callback function on date click | - |
| onChangeYear | (date_ad) => {} | Callback function on year change | - |
| onChangeMonth | (date_ad) => {} | Callback function on month change | - |
| maxDate | "" | Maximum allowed date in "YYYY-MM-DD" format | "2050-12-31" |
| minDate | "" | Minimum allowed date in "YYYY-MM-DD" format | "2000-01-01" |
| weekends | [0, 6] | Array of weekend days (0 = Sunday, 1 = Monday, ..., 6 = Saturday) | [0, 6] |
| tileContent | (date_ad) => React.ReactNode | Custom content for a date tile | (date_ad) => {date_ad} |
License
The MIT License.