Skip to content

Accordion

<bh-accordion>

The Accordion component (bh-accordion) provides a way to organize content into collapsible sections, making it ideal for FAQs, product descriptions, or any content that benefits from progressive disclosure.

Basic Usage

This is the content of the accordion that will be shown or hidden when clicked.

Variants

The accordion component comes with several style variants to match your design needs.

Default

The default accordion has a clean, minimal style with a light background.

This is the content of the default accordion.

Outline

A dark-themed accordion with a contrasting border.

This is the content of the outline accordion.

Outline Transparent

Similar to outline but with transparent backgrounds.

This is the content of the outline transparent accordion.

Modern

A sleek, modern design with subtle shadows and no borders.

This is the content of the modern accordion.

Color Variants

The accordion comes in various color variants to match your application’s theme:

Primary-themed accordion content.

Secondary-themed accordion content.

Danger-themed accordion content.

Info-themed accordion content.

Warning-themed accordion content.

Success-themed accordion content.

Special Variants

This is the content of the gradient accordion.

This is the content of the tricolor accordion.

Sizes

The accordion component comes in three different sizes:

This is a small accordion (30% width).

This is a half-width accordion (50% width).

This is a full-width accordion (100% width).

Accordion Groups

You can group multiple accordions together for a cohesive look and behavior.

Basic Group

Content for the first accordion.

Content for the second accordion.

Content for the third accordion.

Combined Group

Create a seamless group of accordions with the combined attribute:

Content for the first accordion.

Content for the second accordion.

Content for the third accordion.

Single Open Mode

Ensure only one accordion is open at a time within a group:

Content for the first accordion.

Content for the second accordion.

Content for the third accordion.

Advanced Features

Default Open

Make an accordion open by default:

This accordion is open by default.

Custom Icons

Change the default chevron icon:

This accordion uses a plus/minus icon instead of chevron.

Real-world Examples

FAQ Section

Frequently Asked Questions

Bharat UI is a modern web component library designed for Indian websites and applications.

You can install Bharat UI via npm or use it directly via CDN.

Yes, all Bharat UI components are designed to be fully responsive across devices.

Properties

bh-accordion Properties

PropertyTypeDescription
headerStringThe text displayed in the accordion header
variantStringStyle variant (default, outline, outline-transparent, modern, primary, secondary, danger, info, warning, success, gradient, tricolor)
sizeStringSize of the accordion (small, half, full)
widthStringCustom width (overrides size)
borderStringCustom border style
paddingStringCustom padding
fontSizeStringCustom font size
colorStringCustom text color
iconNameStringIcon to display (requires bh-icon component)
iconSizeStringCustom icon size
groupIdStringID for grouping accordions (set automatically when using bh-accordion-group)
isOpenBooleanWhether the accordion is open
animatedBooleanWhether to animate transitions