React HTML Attributes Store

1.4.6 · abandoned · verified Sun Apr 19

react-html-attributes is a JavaScript utility library that provides a programmatic store of HTML and SVG attributes understood by React, organized by their respective element tags. It includes global attributes accessible via a special '*' key and lists of supported HTML and SVG tags under an 'elements' key. The current stable version is 1.4.6, with the last release occurring in April 2018. This package is no longer actively maintained, meaning its data regarding React-supported attributes and elements is significantly outdated relative to contemporary React versions. While it once offered a direct way to access these lists, modern React development typically relies on explicit JSX attributes and React's internal handling, often making this package's utility superseded for new projects. It differentiates itself by providing a structured, static data set, rather than dynamic introspection or attribute validation.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import the library using CommonJS and access the global HTML attributes and SVG element lists.

const htmlElementAttributes = require('react-html-attributes');

// Access global React-supported HTML attributes
console.log('Global attributes:', htmlElementAttributes['*'].slice(0, 5));

// Access SVG element tags supported by React
console.log('SVG elements:', htmlElementAttributes['elements']['svg'].slice(0, 5));

// Example: Get attributes for a specific tag (e.g., 'div')
// Note: This library might not have keys for all specific tags if they only use global attributes.
// To illustrate, we'll check if a common HTML tag exists or fall back to global.
const divAttributes = htmlElementAttributes['div'] || htmlElementAttributes['*'];
console.log('Attributes for div (or global if not specific):', divAttributes.slice(0, 5));

view raw JSON →