You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/guides/custom-components.mdx
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@ Custom components allow you to extend DayPicker beyond just using [formatters](.
28
28
29
29
## Implementing a Custom Component
30
30
31
-
Pass the components you want to customize to the `components` prop. See the [list of custom components](#list-of-custom-components) below.
31
+
- Pass the components you want to customize to the `components` prop (see the [list of custom components](#list-of-custom-components) below).
32
+
- Consider reusing the core components and composing your customizations on top of them.
33
+
- Use a custom React Context to share state between your custom components and your application.
32
34
33
35
```tsx
34
36
<DayPicker
@@ -107,32 +109,36 @@ The DayPicker context provides the current state of the calendar, including the
107
109
108
110
### Intercepting Click Events
109
111
110
-
For example, you can use a custom [DayButton](../api/functions/DayButton.md) to select days with a double-click event.
112
+
For example, you can use a custom [DayButton](../api/functions/DayButton.md) to select days with a double-click event. This approach uses a custom React context to share the selected date state between the custom `DayButton` and the main component.
0 commit comments