Components
FAQ
The FAQ component is a reusable Angular component for displaying frequently asked questions in an interactive accordion style.
Features
- Accordion Layout: Displays questions and answers in a collapsible format for a clean and organized look.
- Dynamic Content: Supports easy updates to questions and answers through a structured data model.
- Customizable Input: Accepts an
@Inputproperty to dynamically provide questions and answers. - Responsive Design: Adapts seamlessly to various screen sizes for a smooth user experience.
- Primeng Integration: Leverages the PrimeNG Accordion module for a polished and interactive interface.
Usage
Step 1: Import the Component
Add the FaqComponent to your Angular project by including it in your module or component imports array.
Step 2: Add the Template
Include the FAQ component in your template and provide the questions input:
Step 3: Define the Questions
Create an array of FaqElement objects in your TypeScript file to pass as the input:
Component Structure
HTML Template
The default structure includes:
- Header: A bold heading to introduce the FAQ section.
- Accordion: A collapsible accordion from PrimeNG. Display questions as headers and answers as content.
Example Template
Notes
- The FAQ component is designed to simplify the presentation of questions and answers in an intuitive and user-friendly manner.
- Use the
@Inputpropertyquestionsto dynamically provide the FAQ content. - Ensure the
questionsarray follows theFaqElementinterface for consistency.