Skip to content

Can't theme <Accordion> subcomponents directly #959

Open
@nkabour

Description

@nkabour
  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

  1. create a basic accordion component
  2. create a component custom theme
  3. attach the custom theme to the accordion component

Current behavior

custom component theme doesn't change the accordion component styles

Expected behavior

custom component theme applies style changes to the accordion component

Context

What are you trying to accomplish? Small theme customization.
Does this only happen on a specific browser, screen size, or operating system? (Chrome/Safari, MacOS)

Example

import {
  Accordion as AccordionComponent,
  DeepPartial,
  FlowbiteAccordionTheme,
} from "flowbite-react"
import { FC } from "react"
import { AccordionProps } from "./types"

const customTheme: DeepPartial<FlowbiteAccordionTheme> = {
  title: {
    base: "bg-blue-200 hover:bg-blue-100 hover:last-type:rounded-b-lg",
    open: {
      off: "",
      on: "hover:last-type:rounded-b-0",
    },
  },
}

export const Accordion: FC<AccordionProps> = ({ panels, alwaysOpen }) => (
  <AccordionComponent alwaysOpen={alwaysOpen} collapseAll theme={customTheme}>
    {panels.map((el) => (
      <AccordionComponent.Panel key={el.id}>
        <AccordionComponent.Title>
          {el.icon && <span className={`${customTheme.icon}`}>{el.icon}</span>}
          {el.title}
        </AccordionComponent.Title>
        <AccordionComponent.Content>{el.content}</AccordionComponent.Content>
      </AccordionComponent.Panel>
    ))}
  </AccordionComponent>
)
Screenshot 2023-09-13 at 21 03 54 Screenshot 2023-09-13 at 21 04 02

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't workingconfirmedThis bug was confirmedhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions