JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 254
  • Score
    100M100P100Q86400F
  • License BSD-3-Clause

Props from React and html, renamed when appropriate (class => className)

Package Exports

  • react-known-props

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-known-props) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Known Props

Props from React and html, renamed when appropriate (class => className). Because you may want to test props against it.

v2 update:

  • Now exposing functions! ⒡ ↬
  • Find props per html element.
  • Many React specific props covered.
  • Options to include legacy props. (default off)

Usage

install with

yarn add react-known-props

then use with

import { getAllProps, getElementProps, getEventProps, getGlobalProps } from 'react-known-props'

API

All functions return props as strings in an array.

getAllProps

Gets all possible props including all global props, all element specific props and all event props.

// argument 1 (optional): an options object.

getAllProps()
getAllProps({legacy: true})

getElementProps

Gets all html props valid on the element provided as argument. Doesn't include event props.

// argument 1: string. Html element to get props for.
// argument 2: (optional) an options object.

getElementProps("img")
getElementProps("iframe")
getElementProps("table", {legacy: true})
getElementProps("audio", {}) //same as {legacy: false}

getEventProps

Gets all React's event props.

// arguments: none.

getEventProps()

getGlobalProps

Gets all html props valid on any element.

// argument 1 (optional): an options object.

getGlobalProps()
getGlobalProps({legacy: true})

Options supported in an object:

  • legacy: boolean

Wether or not to return deprecated html props.

//defaults to false
{legacy: true}
{legacy: false}

Need more props?

I'd use these packages:

  • aria props: yarn add aria-attributes
  • svg props: yarn add svg-tag-names
  • void html elements (<img/>): yarn add void-elements
  • css props: yarn add known-css-properties

Contributing

All data pulled from MDN web docs and official React docs. MDN can be a deep website to dig for info, I'm sure there are more props (specially legacy) waititing to be added by someone willing to look into every element page.

⚛️ React is awesome 💫