Navigation

Accordion

A collapsible content panel for organizing information in a compact space

Completeness: behavior-required

The stylesheet is only the visible half of this component. It also needs a keyboard map, focus managed across more than one element, ARIA attributes that point at other nodes, and [data-*] attributes that only running code sets — so a CSS-only port will not reproduce it. Use @blakeui/react, or read the interaction contract from the MCP server with get_component_behavior("Accordion") and build the behaviour yourself.

Import

import { Accordion } from '@blakeui/react';

Usage

import {Accordion} from "@blakeui/react";
import {
  ArrowsRotateLeft,
  Box,
  ChevronDown,

Anatomy

Import the Accordion component and access all parts using dot notation.

import { Accordion } from '@blakeui/react';

export default () => (
  <Accordion>
    <Accordion.Item>
      <Accordion.Heading>
        <Accordion.Trigger>
          <Accordion.Indicator />
        </Accordion.Trigger>
      </Accordion.Heading>
      <Accordion.Panel>
        <Accordion.Body/>
      </Accordion.Panel>
    </Accordion.Item>
  </Accordion>
)

Surface

import {Accordion} from "@blakeui/react";
import {
  ArrowsRotateLeft,
  Box,
  ChevronDown,

Multiple Expanded

import {Accordion} from "@blakeui/react";

export function Multiple() {
  return (
    <Accordion allowsMultipleExpanded className="w-full max-w-md">

Controlled

Expanded: getting-started

Learn the basics of blakeUI and how to integrate it into your React project. This section covers installation, setup, and your first component.

"use client";

import {Accordion, Button, useDisclosureGroupNavigation} from "@blakeui/react";
import {ChevronDown, ChevronUp} from "@gravity-ui/icons";
import React from "react";

Custom Indicator

"use client";

import type {Key} from "@blakeui/react";

import {Accordion} from "@blakeui/react";

Disabled State

Entire accordion disabled

Individual items disabled

import {Accordion} from "@blakeui/react";

export function Disabled() {
  return (
    <div className="flex w-full flex-col items-center gap-8">

FAQ Layout

Frequently Asked Questions

Everything you need to know about licensing and usage.

General

Licensing

Support

import {Accordion} from "@blakeui/react";
import {ChevronDown} from "@gravity-ui/icons";

export function FAQ() {
  const categories = [

Custom Styles

import {Accordion, cn} from "@blakeui/react";
import {ChevronDown} from "@gravity-ui/icons";

const items = [
  {

Without Separator

import {Accordion} from "@blakeui/react";
import {ChevronDown, CreditCard, Receipt, ShoppingBag} from "@gravity-ui/icons";

const items = [
  {

Custom Render Function

"use client";

import {Accordion} from "@blakeui/react";
import {
  ArrowsRotateLeft,

Styling

Passing Tailwind CSS classes

"use client";

import { Accordion, cn } from "@blakeui/react";
import {Icon} from "@iconify/react";

Customizing the component classes

To customize the Accordion component classes, you can use the @layer components directive.
Learn more.

A worked example is in Styling.

blakeUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.

CSS Classes

The Accordion component uses these CSS classes (View source styles):

Base Classes

  • .accordion - Base accordion container
  • .accordion__body - Content body container
  • .accordion__heading - Heading wrapper
  • .accordion__indicator - Expand/collapse indicator icon
  • .accordion__item - Individual accordion item
  • .accordion__panel - Collapsible panel container
  • .accordion__trigger - Clickable trigger button

Variant Classes

  • .accordion--outline - Outline variant with border and background

State Classes

  • .accordion__trigger[aria-expanded="true"] - Expanded state
  • .accordion__panel[aria-hidden="false"] - Panel visible state

Interactive States

The component supports both CSS pseudo-classes and data attributes for flexibility:

  • Hover: :hover or [data-hovered="true"] on trigger
  • Focus: :focus-visible or [data-focus-visible="true"] on trigger
  • Disabled: :disabled or [aria-disabled="true"] on trigger
  • Expanded: [aria-expanded="true"] on trigger

API Reference

Accordion Props

PropTypeDefaultDescription
allowsMultipleExpandedbooleanfalseWhether multiple items can be expanded at once
defaultExpandedKeysIterable<Key>-The initial expanded keys
expandedKeysIterable<Key>-The controlled expanded keys
onExpandedChange(keys: Set<Key>) => void-Handler called when expanded keys change
isDisabledbooleanfalseWhether the entire accordion is disabled
variant"default" | "surface""default"The visual variant of the accordion
hideSeparatorbooleanfalseHide separator lines between accordion items
classNamestring-Additional CSS classes
childrenReactNode-The accordion items
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, AccordionRenderProps>-Overrides the default DOM element with a custom render function.

Accordion.Item Props

PropTypeDefaultDescription
idKey-Unique identifier for the item
isDisabledbooleanfalseWhether this item is disabled
defaultExpandedbooleanfalseWhether item is initially expanded
isExpandedboolean-Controlled expanded state
onExpandedChange(isExpanded: boolean) => void-Handler for expanded state changes
classNamestring-Additional CSS classes
childrenReactNode-The item content
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, AccordionItemRenderProps>-Overrides the default DOM element with a custom render function.

Accordion.Trigger Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReactNode | RenderFunction-Trigger content or render function
onPress() => void-Additional press handler
isDisabledboolean-Whether trigger is disabled
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, TriggerRenderProps>-Overrides the default DOM element with a custom render function.

Accordion.Panel Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReactNode-Panel content
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, AccordionPanelRenderProps>-Overrides the default DOM element with a custom render function.

Accordion.Indicator Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReactNode-Custom indicator icon

Accordion.Body Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReactNode-Body content

On this page