Theme configuration
component()
#
Allows using a custom component for a navigation item. Useful if you want to add custom functionality to your sidebars (or other navigation structures).
Example#
function DonateButton() {
return (
<div>
<Button>Donate</Button>
</div>
)
}
export default defineTheme({
directories: [
directory("dir-a", {
sidebar: [
link("Home", "/home"),
component(() => <DonateButton />)
]
})
],
})
Reference#
function component(comp);
comp() => ReactNoderequired
A function that returns JSX. You can run React hooks in here.
Reference - Options#
function component(options);
optionsCustomComponentComponent
Options for this custom component item.