1.0.1 • Published 4 years ago

@firstandthird/faqs v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Accessible FAQs module.

Installation

npm install @firstandthird/faqs

Usage

In your project import the library:

import '@firstandthird/faqs'

// or

import Faqs from '@firstandthird/faqs'

Module Options

OptionTypeDefaultDescription
animateHeight{Boolean}falseEnable expand/collapse height animation (requires CSS, see example)
closeOthers{Boolean}trueOnly allows one expanded element at a time
hash{Boolean}trueExpand elements whose ID matches the current URL hash

Example markup

<dl data-module="Faqs"
    data-module-animate-height="false"
    data-module-close-others="true"
    data-module-hash="true">
  <dt>
    <button
      type="button"
      aria-expanded="false"
      aria-controls="question-1"
      data-action="toggle">Question 1?</button>
  </dt>
  <dd id="question-1" aria-hidden="true">
    Lorem ipsum dolor sit amet consectetur, adipisicing elit.
  </dd>
</dl>

Full example here.


A First + Third Project

1.0.1

4 years ago

1.0.0

4 years ago