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: src/components/ThemeProvider/ThemeProvider.stories.tsx
+27-6Lines changed: 27 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -51,23 +51,44 @@ type Story = StoryObj<typeof ThemeProvider>
51
51
*
52
52
* In general, most useful theme properties are exposed on `theme.custom`. (Root
53
53
* `theme` properties are used internally by MUI.) See typescript definitions
54
-
* for more information.
54
+
* for more information about `theme.custom`.
55
+
*
56
+
* ## Further Customized Theme with `createTheme`
57
+
* Consuming applications can customize `smoot-design`'s default theme by creating
58
+
* a theme instance with `createTheme` and passing it to `ThemeProvider`:
59
+
*
60
+
* ```tsx
61
+
* const customTheme = createTheme({...})
62
+
*
63
+
* <ThemeProvider theme={customTheme}>
64
+
* {children}
65
+
* </ThemeProvider>
66
+
* ```
67
+
*
55
68
*
56
69
* ### Custom Link Adapter
57
70
* One particularly notable property is `theme.custom.LinkAdapter`. Some `smoot-design`
58
71
* components render links. These links are native anchor tags by default. In
59
72
* order to use these components with custom routing libraries (e.g. `react-router`
60
-
* or `next/link`), you can provide a custom link adapter. Link components wills
73
+
* or `next/link`), you can provide a custom link adapter.
61
74
*
62
-
* As an example, `ButtonLink` will:
75
+
* Components such as `ButtonLink` will:
63
76
* - use `Component` on `ButtonLink` if specified (`<ButtonLink Component={Link} />`)
64
77
* - else, use `theme.custom.LinkAdapter` if specified,
65
78
* - else, use `a` tag.
66
79
*
67
-
* If you provide a custom `LinkAdapter` and need **aditional** props, you can
68
-
* use [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) to add the custom props to relevant
69
-
* components. For example, if using `next/link`
80
+
* For example, to use `next/link` as the default link implementation:
81
+
*
82
+
* ```tsx
83
+
* import Link from "next/link"
84
+
* const theme = createTheme({ LinkAdapter: Link })
70
85
* ```
86
+
*
87
+
* You can use [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
88
+
* to add the custom props to relevant components. For example, to expose
89
+
* `next/link`'s `scroll` prop on `ButtonLink`:
90
+
*
91
+
* ```ts
71
92
* // Add scroll prop to all components using LinkAdapter
0 commit comments