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
{{ message }}
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: src/docs/documentation/customizing/creating-your-themes.mdx
+13-20Lines changed: 13 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
-
name: Creating Themes
3
-
route: /docs/creating-themes
2
+
name: Creating your themes
3
+
route: /docs/creating-your-themes
4
4
parent: Documentation
5
-
menu: References
5
+
menu: Customizing
6
6
---
7
7
8
-
# Creating Themes
8
+
# Creating your themes
9
9
10
10
One of the main features of Docz is that you can create your own theme from scratch and just use data parsed from Docz.
11
11
We provide a bunch of components that can help you to create your own theme without pain.
@@ -16,30 +16,23 @@ Let's use this project structure through the following examples:
16
16
pages/
17
17
hello-world.mdx
18
18
src/
19
+
gatsby-theme-docz/
20
+
index.js
19
21
ui/
20
22
Page.js
21
-
theme.js
22
23
doczrc.js
23
24
package.json
24
25
```
25
26
26
-
## Setting theme filepath
27
-
28
-
First of all, you need to set the path of your theme in the [Project Configuration](/docs/project-configuration) by changing the `theme` property.
29
-
30
-
```js
31
-
// doczrc.js
32
-
exportdefault {
33
-
theme:'src/theme',
34
-
}
35
-
```
27
+
The oldest way to acomplish that is by using the `theme` property inside the `doczrc.js` file. Now, if you want to create
28
+
your own theme, just create a file located at `src/gatsby-theme-docz/index.js`
36
29
37
30
## Creating your theme component
38
31
39
32
Then just create your component passing the `children` inside it and export it as default using the [`theme()`](/docs/components-api) high order component as an enhancer.
40
33
41
34
```js
42
-
// src/theme.js
35
+
// src/gatsby-theme-docz/index.js
43
36
importReactfrom'react'
44
37
import { theme } from'docz'
45
38
@@ -60,7 +53,7 @@ Each theme has your own default `themeConfig` object that define whatever you wa
60
53
It's very useful to set something like custom fonts, colors, spaces, some styles properties and other project global variables.
61
54
62
55
```js
63
-
// src/theme.js
56
+
// src/gatsby-theme-docz/index.js
64
57
importReactfrom'react'
65
58
import { theme } from'docz'
66
59
@@ -81,7 +74,7 @@ By default, Docz will use this object as default configuration and merge it with
81
74
Using together with `useConfig` hook you can do a lot of things, like use css-in-js theming or retrieve props from your `themeConfig` in a deep render component.
82
75
83
76
```js
84
-
// src/theme.js
77
+
// src/gatsby-theme-docz/index.js
85
78
importReactfrom'react'
86
79
import { theme, useConfig } from'docz'
87
80
import { ThemeProvider } from'emotion-theming'
@@ -113,7 +106,7 @@ provide for MDX and Docz each component that you want to render inside your docu
113
106
components passed to the provider, you can easily change how your mdx file will be rendered and change default behaviors and styles.
0 commit comments