This repo contains a basic react-app example that inserts a custom header and footer into Fern docs using custom JS and CSS.
ReactDOM.render(
React.createElement(NavHeader),
document.getElementById('fern-header'),
)

ReactDOM.render(
React.createElement(NavFooter),
document.getElementById('fern-footer'),
)

cd custom-app
yarn build
fern generate --docs
- This approach is subject to change as we make improvements to the plugin architecture
ReactDOM.render()
may need to be called multiple times to prevent it from unmounting (this side-effect will be removed in the future).yarn build
ornpm build
must outputdist
files with deterministic names. This example uses this vite config to accomplish it. Then, reference the js/css files in the docs.yml to get picked up by Fern Docs.- You may need to update your CD steps to include building the react-app.
- If you use tailwind, make sure to prefix the tailwind classes and disable preflight to deconflict with the Fern's stylesheet.