1.0.6 • Published 3 years ago

react-header-element v1.0.6

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

React Header Element

Add condtional header logic to your App to seamlessly switch between 'Functional' header elements <h1> and decorative header classes <div class="h1"> to assist in aligning your site to WCAG guidelines for misused headers.

Why was this package created?

Accessibility for websites is now more desired than ever with growing online usage. As such, making user experiences for those who use assisted technologies better is the main reason for this package.

For more information see WCAG 2.1 AA - Headings and Labels.

What does it solve?

Simply put, it allows you to switch between a header element and a header class by specifying the criteria or via api fed from a CMS. It keeps it tidy and reduces unnecessary extra lines of code.

Basic Usage

import React from "react";
import HeaderElement from "react-header-element";

const ComponentName = () => {
  return (
    <div className="container">
      <div className="row">
        <div className="col-md-12">
          <HeaderElement
            isFunctional={true}
            title="Hello World"
            value="h1"
            fallBack="h2"
          />
        </div>
      </div>
    </div>
  );
};

export default ComponentName;

Installation

npm install react-header-element --save

Available Props

NameTypeDescription
isFunctionalBooleanRequired. Is the element a header or a div class.
valueStringRequired. What header is it? h1 - h6 / p.
fallBackStringRequired. The header you wish to fall back on should no value exist (h1 - h6)
titleStringRequired. The title of your header.
classNameStringAdd additional classes for styling.
idStringAdd an ID for behaviours such as anchors.
styleStringUse inline styling should you need to dynamically add CSS.
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago