1.0.4 • Published 7 years ago

faq-viewer v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

faq-viewer

React component for viewing FAQs

NPM JavaScript Style Guide

Example

Check out the example running on github pages

Install

npm install --save faq-viewer

Usage

import React, { Component } from 'react'

import FAQViewer from 'faq-viewer'

const questions = [
  {
    title: "Use Component",
    question: "Can I use this component for my project?",
    answer: "Yes",
    tags: ["category1"],
  }
]

class Example extends Component {
  render () {
    return (
      <FAQViewer questions={questions} />
    )
  }
}

Props

PropertyTypeRequiredDefault valueDescription
titlestringnoFrequently Asked QuestionsThe component title
questionLabelstringnoQuestion:Bold label before long question
answerLabelstringnoAnswer:Bold label before answer
questionsarrayyesEither empty array or array of question objects
enableSearchbooleannotrueShould the component show search bar?
searchPlaceholderstringnoSearch for content or tagsSearch input placeholder text
searchHelperTextstringnoquestions shownText for showing number of search results

Question Object

The question objects are of the following shape:

{
  title: "title of the question",
  question: "question text",
  answer: "answer text",
  tags: ["tag1", "tag2"], // Array of strings, can be empty
  links: [], // Array of link objects
}

Link Objects

The link objects are added as ordered list of links. They have the following shape:

{
  text: "Link text",
  link: "www.example.com",
}

Attributions

Icons

Material Icons are used.

License

MIT © ntnuikoiene

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago