react-faq-component

releaseissueslicense

Demo

default view:

FAQ (How it works)

More demo

Usage

Install the package.
npm install --save react-faq-component
Import the package.
import Faq from 'react-faq-component';

example:

import React, { Component } from 'react';
import Faq from 'react-faq-component';

const data = {
  title: "FAQ (How it works)",
  rows: [
    {
      title: "Lorem ipsum dolor sit amet,",
      content: "Lorem ipsum dolor sit amet, consectetur "
    },
    {
      title: "Nunc maximus, magna at ultricies elementum",
      content: "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam."
    },
    {
      title: "Curabitur laoreet, mauris vel blandit fringilla",
      content: "Curabitur laoreet, mauris vel blandit fringilla, leo elit rhoncus nunc"
    },
    {
      title: "What is the package version",
      content: "v1.0.5"
    }]
}

export default class App extends Component {
  render() {
    return (
      <div>
        <Faq data={data}/>
      </div>
    )
  }
}

Data format

The data passed into react-faq-component is an object having two keys i.e title (String) and rows (array of objects).

{
    "title": "FAQ title",
    "rows": [
        {
            "title": "Question 1",
            "content": "Answer 1"
        },
        {
            "title": "Question 2",
            "content": "Answer 2"
        }
    ]
}