React Showroom screenshot

React Showroom

Author Avatar Theme by Malcolm kee
Updated: 17 Jun 2023
45 Stars

Document React components by declaring props definition and writing markdown.

Categories

Overview:

The React Showroom is a tool that allows you to document and showcase your React components. It helps you generate documentation for your component props, write examples to demonstrate component usage, and provides an editable playground. The Showroom also supports multiple languages for live examples and allows for collaboration by allowing code editing and commenting with shareable URLs. It ensures that your components are SSR-friendly and can be pre-rendered during build time.

Features:

  • Auto generate documentations for component props from TypeScript definitions
  • Write markdown to show examples and create an editable playground
  • Auto generate props control/knobs based on component props type definitions
  • Support for multiple languages in live examples: TypeScript (TSX and TS), JavaScript (JSX and JS), and HTML
  • Collaboration enhancement through code editing and commenting with shareable URLs
  • SSR-friendly components with pre-rendering capability

Installation:

To install React Showroom, you can follow these steps:

  1. Configure your project to use webpack or esbuild.
  2. Install React Showroom using npm:
npm install react-showroom
  1. Add React Showroom to your project:
import { ShowroomProvider } from 'react-showroom';

function App() {
  return (
    <ShowroomProvider>
      {/* Your app components */}
    </ShowroomProvider>
  );
}
  1. Declare the props of your components and write markdown to document them:
import React from 'react';
import { ComponentShowroom } from 'react-showroom';

/**
 * MyButton component description.
 */
const MyButton = ({ label }) => (
  <button>{label}</button>
);

<MyButtonShowroom
  props={{/*
    label: 'Hello World'
  */}}
>
  {`
    ## Example Usage
    
    <MyButton label="Click Me" />
  `}
</MyButtonShowroom>

Summary:

React Showroom is a tool that simplifies the process of documenting and showcasing React components. It provides automatic generation of component prop documentation, an editable playground, and collaboration features. By allowing you to write documentation in a more stable medium like markdown, it gives you more freedom and flexibility to migrate to alternative tools in the future. The tool is easy to install and integrate into your existing workflow, allowing you to focus on developing and documenting your components efficiently.