How do I run the styleguide locally?
- go to
mono/es-react-components
- run
npm install
- run
npm run styleguide
- go to http://localhost:6060
How do I debug issues with the styleguide locally?
- go to
mono/es-react-components
- run
npm install
- run
npm run styleguide:verbose
- go to http://localhost:6060
How do I add my component to the styleguide
add your new component to the
sections
inmono/es-react-components/config/sections.js
- if your component has multiple files or it belongs in a new sections make sure to create a new section.
- if your component has multiple files but some are private and should not be exposed, add the files you want to ignore to
mono/es-react-components/config/ignore
. - otherwise add your component in the
Additional Components
section.
reference https://react-styleguidist.js.org/docs/components.html#sections
How do I document my new react component?
- add a
readme.md
tomono/es-react-components/src/<my new ui component>/
- use markdown to document examples
- props and default props will be automatically parsed from your component
- add descriptions to your props by using JSDoc notations
reference https://react-styleguidist.js.org/docs/documenting.html
How do I document anything other than a react component?
- add a
<doc-name>.md
to themono/es-react-components/docs
folder.
What if I need to use an external package as part of my component doc?
you can add the required package and map the function you need for the doc examples.
- add the function and package path to the
context
property instyleguide.config.js
- add the function and package path to the
reference https://react-styleguidist.js.org/docs/configuration.html#context
What if I think the documentation is wrong, could be better, or missing?
- grab a cup of coffee, relax and fix it
¯\_(ツ)_/¯