How do I add title sections within the sidebar? #2704
Answered
by
mutasim77
StephenTangCook
asked this question in
Q&A
-
For example, the Nextra docs site has "Themes" and "More" sub-sections: |
Beta Was this translation helpful? Give feedback.
Answered by
mutasim77
Feb 17, 2024
Replies: 1 comment
-
If we look at the source code in the {
"index": "Introduction",
"guide": "",
"-- Themes": {
"type": "separator",
"title": "Themes"
....
}, You may wonder how this works. Look, we are passing a type of const config: DocsThemeConfig = {
...,
sidebar: {
titleComponent({ title, type }) {
if (type === 'separator') {
return <span className="cursor-default">{title}</span>;
}
return <>{title}</>;
},
defaultMenuCollapseLevel: 1,
toggleButton: true
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
StephenTangCook
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If we look at the source code in the
pages/docs/_meta.json
directory, we can see something like this:You may wonder how this works. Look, we are passing a type of
separator
. Now, in yourtheme.config.ts
file, we can add something like this to ur configurations: