ui icon indicating copy to clipboard operation
ui copied to clipboard

Accordion: change the HTML tag for Trigger

Open ross-peterson opened this issue 1 year ago • 2 comments

This seems simple, but not sure how to change the html tag for the accordion trigger. Currently it seems out of the box it is an h3, and I want it to be an h4. Any thoughts here? Is there a prop on <AccordionTrigger /> for this that I'm missing?

ross-peterson avatar Nov 21 '23 14:11 ross-peterson

Accordion.Trigger is a button. You probably want to change the header. One way I can think of is you can pass asChild prop to the <Accordion.Header> and wrap the children in h4 tag like:

<Accordion.Header asChild className={s.Header}>
  <h4>
    <Accordion.Trigger className={s.Trigger}>
      <span>Is accessible?</span>
      <ChevronDownIcon aria-hidden className={s.Icon} />
    </Accordion.Trigger>
  </h4>
</Accordion.Header>

servesh-chaturvedi avatar Dec 03 '23 12:12 servesh-chaturvedi

Accordion.Trigger is a button. You probably want to change the header. One way I can think of is you can pass asChild prop to the <Accordion.Header> and wrap the children in h4 tag like:

<Accordion.Header asChild className={s.Header}>
  <h4>
    <Accordion.Trigger className={s.Trigger}>
      <span>Is accessible?</span>
      <ChevronDownIcon aria-hidden className={s.Icon} />
    </Accordion.Trigger>
  </h4>
</Accordion.Header>

This works for me. Thanks!

denniswanjiru avatar Jan 17 '24 07:01 denniswanjiru

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Feb 12 '24 23:02 shadcn