# React Styleguidist — Isolated React Component Documentation > React Styleguidist is a development environment and documentation generator for React components that renders live-editable examples alongside prop tables and markdown docs. ## Install Save as a script file and run: # React Styleguidist — Isolated React Component Documentation ## Quick Use ```bash # Install npm install --save-dev react-styleguidist # Start the dev server npx styleguidist server # Build a static style guide npx styleguidist build ``` ## Introduction React Styleguidist generates a living style guide from your React components. It extracts prop types and JSDoc comments automatically, renders live-editable code examples from Markdown files, and serves everything in an interactive development environment that makes component documentation effortless. ## What React Styleguidist Does - Auto-generates prop documentation tables from PropTypes, TypeScript, or Flow definitions - Renders live, editable code examples that update in real time - Organizes components into sections with Markdown-based descriptions - Provides an isolated rendering sandbox for each component example - Supports custom webpack configuration for project-specific build setups ## Architecture Overview Styleguidist scans your source tree for component files, extracts metadata using react-docgen, and parses companion Markdown files for code examples. At dev time, a webpack-based dev server compiles and serves the style guide as a single-page React application. Each code example runs in an isolated context using a sandboxed editor powered by CodeMirror, enabling live editing without affecting other examples on the page. ## Self-Hosting & Configuration - Configure via `styleguide.config.js` at the project root - Specify component glob patterns to control which files are documented - Add `Readme.md` or `ComponentName.md` files next to components for examples - Use `webpackConfig` to reuse your existing project webpack setup - Build a static HTML site with `styleguidist build` for deployment to any host ## Key Features - Live editor: modify example code and see results instantly in the browser - Prop tables: auto-extracted from PropTypes, TypeScript interfaces, or Flow types - Section organization: group components logically with nested Markdown sections - Theme customization: override styles and layout via a theme configuration object - Hot module replacement: component changes reflect immediately during development ## Comparison with Similar Tools - **Storybook** — More ecosystem plugins and addons; Styleguidist is simpler with Markdown-first documentation - **Docz** — MDX-based documentation; Styleguidist uses plain Markdown with embedded JSX examples - **Ladle** — Vite-native Storybook alternative; Styleguidist is webpack-based - **Cosmos** — Focuses on component fixtures; Styleguidist emphasizes prose documentation alongside examples ## FAQ **Q: Does it work with TypeScript?** A: Yes. It uses react-docgen-typescript to extract prop types and descriptions from TypeScript interfaces. **Q: Can I use it alongside Storybook?** A: Yes. They serve different purposes and can coexist. Styleguidist focuses on written documentation while Storybook focuses on interactive component states. **Q: Does it support CSS Modules or styled-components?** A: Yes. Since it uses your project's webpack config, any styling approach that works in your build also works in Styleguidist. **Q: Can I customize the look of the generated site?** A: Yes. The theme object in `styleguide.config.js` lets you override colors, fonts, spacing, and layout. ## Sources - https://github.com/styleguidist/react-styleguidist - https://react-styleguidist.js.org --- Source: https://tokrepo.com/en/workflows/asset-87be2133 Author: Script Depot