Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

styled-system-props-table

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

styled-system-props-table

Props table generator with styled-system decorator

  • 0.1.3
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Styled System props table

This is a props table generator for documenting a React component's props using Styled System. The library can be extended to suit your own implementation of styled-system but the idea is to output a table of props to document components with wide, highly repetitive props footprints by analyzing their propTypes and defaultProps settings and applying rich documentation to the table. This has several advantages over the Storybook Docs add-on's props table generator:

  • Richer documenation, including links to Styled System documenation, so any component consumer can easily understand it.
  • Props are sorted by interpolation function so it's easy to quickly scan which prop categories are being used.
  • Table has highlights custom props for faster readability
  • Extending prop descriptions is done in the component itself using JSX, rather than reading code hints from the source file at compile time.

Compatible with csf, mdx, or any jsx-compatible format.

Install

yarn add styled-system-props-table

Simple Example

Only one prop is required component which takes a React component.

import { StyledSystemPropsTable } from 'sytled-system-props-table'
import Card from 'path-to-components/Card'

<StyledSystemPropsTable component={Card} />

Less-Simple Example

You can intercept and decorate individual prop rows as well. The component contains a render function which passes an object of all analyzed props properties as its argument. Just import the PropRow component and give it a name prop which matches the name of the prop you want to modify.

import { StyledSystemPropsTable, PropRow } from 'sytled-system-props-table'
import Card from 'path-to-components/Card'

<StyledSystemPropsTable component={Card} >
  {(props) => {
    return [
      <PropRow name="someProp" {...props.someProp}>
        Put a rich description here. This is JSX so go nuts.
      </PropRow>
    ]
  }}
</StyledSystemPropsTable>

DEMO

TODO

Extending the Styled System decorator

TODO

FAQs

Package last updated on 22 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc