ui
ui copied to clipboard
Accordion: change the HTML tag for Trigger
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?
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>
Accordion.Triggeris a button. You probably want to change the header. One way I can think of is you can passasChildprop 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!
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.