Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to render Components brought from Component Library (Ex: material-ui react) #165

Open
ethanny2 opened this issue Aug 12, 2021 · 1 comment

Comments

@ethanny2
Copy link

ethanny2 commented Aug 12, 2021

This library seems great so far, but I have my own components that are built using Material UI React's component library and I was wondering how do I render those components as an example

Ex:

import {Box} from '@material-ui/core';
/**
 * Some documented component
 *
 * @component
 * @example
 *  <Box size={size}> </Box> 
 */
const Test = ({size}) =>(
   <Box size={size}> </Box> 
)

When I generate the docs will it detect the used component as an import and bring it in or is there any extra steps/ is this not possible with this library?

@Gi-wq
Copy link

Gi-wq commented Apr 28, 2022

I’ve a similar problem, the only way that i found to use external component in @example is tags it as @componet.

Starting from this: https://github.com/SoftwareBrothers/better-docs#mixing-components-in-preview
In component 1 you can import and use any external react modules

In your case, Have you try to test something like this?

/**
 * Some documented component
 *
 * @component
 * @example
 *  <Test size=‘4’/>
 */
const Test = ({size}) =>(
   <Box size={size}> </Box> 
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants