Add support for custom days in the Calendar component
See original GitHub issueRequested Behavior
The developer would have the ability use their own component in each day block in the Calendar. The component should also have access to the current day it is rendering, the selected date(s) on the calendar, and if the Calendar is handling range selection.
Example
Implementation
The Select component solves similar problems, and it does so by providing a function as the child for the component. I believe this is a good solution for the Calendar also.
The Calendar would now have a children
prop that accepts a function. The function is passed 3 arguments :
day
- the current day being rendered (string in ISO8601 format)selected
- the day(s) that is selected (string in ISO8601 format or array of strings in ISO8601 format)inRange
- whether the calendar is using range selection (boolean)
The Calendar would now have a fill
prop which is a boolean. This tells the calendar to fill the width and height of the container, and that the days should have a width of 14.3%.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
React-Calendar: Build and customize a simple calendar
React-Calendar is a simple calendar library that provides the ability to pick days, months, years, or even decades. It also supports date ...
Read more >React Calendar: How to Build a Reusable Cal
This lesson will show you how to create a simple reusable calendar component that you can use in any React application using React-Calendar....
Read more >Customization in React Calendar component
Calendar allows you to customize the entire appearance by using the custom CSS and renderDayCell event to customize the each day cell.
Read more >Angular Calendar: Displaying Custom Set of Days
Angular project that displays an event calendar component with day, week and month views that share the same data and can be easily...
Read more >Create a custom calendar in React
We are going to build simple calendar component in which you will be able to select a date from an active month. While...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve taken a shot at it in PR #4508 . Please let me know if I’ve missed anything, or if there are additional changes you want me to make.
I was drawing a blank on what the correct treatment should be when using the
fill
property withdaysOfWeek
. The spacing for the days of the week are a little off. You should be able to see what I mean by navigating to the “Fill” Calendar story, or you can checkout the screenshot in the PR. Please let me know if you have any ideas.In the Calendar I noticed the box-sizing isn’t currently set to border-box. Is that on purpose? If not would it be an issue to set it to border-box. I would think it would help with the style of the custom borders. Currently borders get cut off if they are applied.
Would an isAlternate property be helpful also? This would allow the developer to do things like apply alternating backgrounds on the cells.
@ShimiSun Thanks again for all of your help! It can be closed!