1.0.3 • Published 5 years ago

react-docgen-props-table v1.0.3

Weekly downloads
453
License
MIT
Repository
github
Last release
5 years ago

react-docgen-props-table (demo)

Beautiful Props Table for React Docgen.

NPM JavaScript Style Guide

This is a standalone version of the (now deprecated) PropsTable component from Docz.

Install

npm install --save react-docgen-props-table

Usage

import React, { Component } from 'react'

import PropsTable from 'react-docgen-props-table'

// this was generated via react-docgen
const docgenInfo = {
  "description": "General component description.",
  "displayName": "MyComponent",
  "methods": [],
  "props": {
    "foo": {
      "type": {
        "name": "number"
      },
      "required": true,
      "description": "Description foo."
    },
    "bar": {
      "type": {
        "name": "string"
      },
      "required": false,
      "description": "Description bar.\n\n- markdown list-item 1\n- markdown list-item 2",
      "defaultValue": {
        "value": "'bar'",
        "computed": false
      }
    },
    "baz": {
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Description baz."
    }
  }
}

class Example extends Component {
  render () {
    return (
      <PropsTable props={docgenInfo.props} />
    )
  }
}

Examples

Check out the demo for live examples.

License

Credit goes to Pedro Nauck and docz for the initial implementation.

MIT © transitive-bullshit