Skip to content

Commit

Permalink
feature: Added documentation to use the prop toggleCalendarOnIconClick
Browse files Browse the repository at this point in the history
Added a documentation to demonstrate the usage of toggleCalendarOnIconClick prop to toggle the reactCalendar open status
  • Loading branch information
Balaji Sridharan committed Dec 18, 2023
1 parent 79b1595 commit d4790be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs-site/src/components/Examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import ExternalForm from "../../examples/externalForm";
import CalendarIcon from "../../examples/calendarIcon";
import CalendarIconExternal from "../../examples/calendarIconExternal";
import CalendarIconSvgIcon from "../../examples/calendarIconSvgIcon";
import ToggleCalendarOnIconClick from "../../examples/toggleCalendarOnIconClick";

import "./style.scss";
import "react-datepicker/dist/react-datepicker.css";
Expand Down Expand Up @@ -129,6 +130,10 @@ export default class exampleComponents extends React.Component {
title: "Calendar Icon using External Lib",
component: CalendarIconExternal,
},
{
title: "Toggle Calendar open status on click of the calendar icon",
component: ToggleCalendarOnIconClick,
},
{
title: "Calendar container",
component: CalendarContainer,
Expand Down
11 changes: 11 additions & 0 deletions docs-site/src/examples/toggleCalendarOnIconClick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
() => {
const [selectedDate, setSelectedDate] = useState(new Date());
return (
<DatePicker
showIcon
toggleCalendarOnIconClick
selected={selectedDate}
onChange={(date) => setSelectedDate(date)}
/>
);
};

0 comments on commit d4790be

Please sign in to comment.