Skip to content

Commit

Permalink
scaffold docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bagusajieiswara committed Jan 4, 2025
1 parent d1efa81 commit 57fff36
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## Overview of Accordion Primitive Component

The Accordion Primitive Component is a versatile UI element that allows users to toggle the visibility of content sections. It is commonly used to display FAQs, lists, or any content that benefits from being collapsible. This component enhances user experience by organizing content in a compact and accessible manner.

### Key Features
- **Collapsible Sections**: Users can expand or collapse sections to view or hide content.
- **Customizable**: Easily style and configure the accordion to fit your design needs.
- **Accessible**: Built with accessibility in mind, ensuring it is usable for all users.

### Quick Start
To use the Accordion Primitive Component in an Angular project, include it in your module and configure the sections you want to be collapsible. Below is a basic example:

1. Install the component library:
```bash
npm install @ngx-primer/accordion
```

2. Import the module in your Angular application:
```typescript
import { NgxPrimerAccordionModule } from '@ngx-primer/accordion';

@NgModule({
imports: [NgxPrimerAccordionModule],
})
export class AppModule {}
```

3. Use the component in your template:
```html
<ngx-primer-accordion>
<ngx-primer-accordion-item title="Section 1">
Content for section 1.
</ngx-primer-accordion-item>
<ngx-primer-accordion-item title="Section 2">
Content for section 2.
</ngx-primer-accordion-item>
</ngx-primer-accordion>
```

### Prim

#### Root Component
The `root` component serves as the container for the entire accordion. It manages the state and behavior of the accordion, ensuring that only one section is expanded at a time if desired.

#### Item Component
The `item` component represents an individual item within the accordion. Each item can be expanded or collapsed independently, allowing users to interact with specific sections of content.

#### Content Component
The `content` component holds the details or information to be displayed when an item is expanded. This is where you place the main content that you want to show or hide.

#### Trigger Component
The `trigger` component handles user interactions to expand or collapse an item. It typically includes a button or clickable element that users can interact with to toggle the visibility of the content.

### Example Usage
Here is an example of how to use the ngxPrimerAccordion component in your Angular template:

```html
<ngx-primer-accordion>
<ngx-primer-accordion-item>
<ngx-primer-accordion-trigger>
Section 1
</ngx-primer-accordion-trigger>
<ngx-primer-accordion-content>
Content for section 1.
</ngx-primer-accordion-content>
</ngx-primer-accordion-item>
<ngx-primer-accordion-item>
<ngx-primer-accordion-trigger>
Section 2
</ngx-primer-accordion-trigger>
<ngx-primer-accordion-content>
Content for section 2.
</ngx-primer-accordion-content>
</ngx-primer-accordion-item>
</ngx-primer-accordion>
```

### Customization
You can customize the appearance and behavior of the accordion by applying your own styles and configurations. The component is designed to be flexible and easily integrated into your existing design system.

### Accessibility
The ngxPrimerAccordion component is built with accessibility in mind. It includes ARIA attributes and keyboard navigation support to ensure that it is usable for all users, including those who rely on assistive technologies.

### Conclusion
The ngxPrimerAccordion component is a powerful and flexible tool for creating collapsible content sections in your Angular applications. By leveraging its sub-components, you can build a rich-feature accordion that enhances the user experience and organizes content effectively.

0 comments on commit 57fff36

Please sign in to comment.