use-date-input - Build Your Own Date Picker
Getting StartedStateThemingCreate Your Own ThemeCompositionDate FrameworksLocalization
Components
Hooks
AnimatedGroupAnimatedMonthGroupCalendarCalendarProviderClickOutsideDayDayOfWeekHeaderHomeMonthMonthGroupPopperRootWeekWeekHeaderuseCalendarDispatchuseCalendarPropsuseCalendarStateuseDateAPIuseDateInputuseDateRangeInput

Theming

Your theme defines your brand, so use-date-input components are naked, with just minimal layout styles.

Instead use-date-input provides a comphrensive approach to theming, enabling you to replace, either the style or the component, for every use-date-input element.

Using the theme prop, go from the default styles

2021
June
Su
Mo
Tu
We
Th
Fr
Sa
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
July
Su
Mo
Tu
We
Th
Fr
Sa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

to this, with just one theme prop

2021
June
Su
Mo
Tu
We
Th
Fr
Sa
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
July
Su
Mo
Tu
We
Th
Fr
Sa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Create Your Own Theme

Built upon styled-components each element of use-date-input is themable by overriding/etending the default style.

If you want to style the default components then create a new theme, using the theme prop.

// import { Calendar } from "@use-date-input/core";
// import { adapter as dateAdapter } from "@use-date-input/date-fns-adapter";
const yourTheme = {
AnimatedGroup: { /* Overidden component style */ },,
AnimatedMonthGroup: {},
Day: {},
DayOfWeek: {},
Header: {},
MonthCell: {},
MonthGroup: {},
MonthTitle: {},
Month: {},
MonthHeader: {},
NextButton: {},
PreviousButton: {},
Root: {},
YearTitle: {},
Week: {},
WeekHeader: {},
WeekRow: {},
};
function ThemedCalendar(props) {
return (
<Calendar
adapter={dateAdapter}
theme={yourTheme}
{...props}
/>
);
}

Refer to sampleTheme.js from the repo for a further example.

If using input components with the useDateInput/useDateRangeInput hooks, then simply style the elements yourself, before composing with Calendar.