Custom Months Navigation Component Example #2403
Closed
alessandro-dias-fcamara
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If anyone is looking for a custom months navigation example, maybe this could help.
Create the
Nav
component inside the<DayPicker components={}
propThen you'll have access to the
useDayPicker
hook to get thepreviousMonth
,nextMonth
andgoToMonth
method:From there, you can write your own logic to handle months navigation, or to disable navigation to previous months before the current date. Here is what I had to do in my case:
Full Working Example:
You can abstract this to another component, to improve the logic and the readability.
Hope this can help someone ✌️
Beta Was this translation helpful? Give feedback.
All reactions