Search code examples
reactjsdocusauruschakra-ui

Docusaurus: is it possible to use components from NPM packages?


I'm currently getting started with Docusaurus. I know that I can write custom components using mdx files (https://docusaurus.io/docs/markdown-features/react), but is it possible to install a React NPM package and use its components?

I tried this with ChakraUI:

import { Switch } from "@chakra-ui/react";

<Switch>{"test"}</Switch>

But just the word "test" is rendered. Thanks for the help!


Solution

  • Fixed, I just had to create a Root component (https://docusaurus.io/docs/using-themes#wrapper-your-site-with-root) and wrap it with ChakraProvider