Use accordions for secondary or optional information that users may want to explore. They help people quickly find relevant content without overwhelming the page.
Avoid hiding essential information or using accordions solely to reduce the amount of content visible on the page.
If you have a discount code this must be applied at the checkout stage pre-payment. Enter the code underneath the order summary in the discount code space. This will then subtract the discount amount from the total order.
Yes. Peatlands are the largest natural carbon store in the world and provide valuable ecosystems for wildlife. By selling only peat-free plants we can help reduce the damage peat extraction has on our natural environment.
While you wait for your gift membership pack to be delivered, you can download a gift certificate for your recipient.
<Accordion type="single">
<AccordionItem value="item-1">
<AccordionTrigger><span class="vds-heading-3">How do I use my discount cod</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Yes. It adheres to the WAI-ARIA design pattern.</p></AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger><span class="vds-heading-3">Is it styled?</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Yes. It comes with default styles that match your theme.</p></AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger><span class="vds-heading-3">Is it animated?</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Yes. It uses CSS animations for smooth transitions.</p></AccordionContent>
</AccordionItem>
</Accordion>Focus state
Accordion triggers follow the global text-based focus state guidelines:
- Yellow
--color-yellowbackground - 3px
blackbox-shadow at the bottom - Text color changes to black for contrast
- Cursor changes to
pointeron hover to indicate clickability
Focus states are triggered by keyboard navigation (Tab key) and meet WCAG 2.2 contrast requirements.
Installation
npm install @vds-testing/react @vds-testing/stylesnpm install @vds-testing/elements @vds-testing/stylesSee Installation for CSS setup.
Usage
React:
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@vds-testing/react"<Accordion type="single">
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
<p className="vds-paragraph-light">Yes. It adheres to the WAI-ARIA design pattern.</p>
</AccordionContent>
</AccordionItem>
</Accordion>Web Components:
<script type="module">
import "@vds-testing/elements";
</script>
<vds-accordion type="single">
<vds-accordion-item value="item-1">
<vds-accordion-trigger>Is it accessible?</vds-accordion-trigger>
<vds-accordion-content>
<p class="vds-paragraph-light">Yes. It adheres to the WAI-ARIA design pattern.</p>
</vds-accordion-content>
</vds-accordion-item>
</vds-accordion>Examples
Multiple
Multiple items can be open simultaneously. Useful when users may need to compare content across sections.
Name, email, and Call02Icon number details.
Street address, city, state, and zip code.
Credit card or PayPal account information.
<Accordion type="multiple">
<AccordionItem value="item-1">
<AccordionTrigger><span class="vds-heading-3">Personal Information</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Name, email, and Call02Icon number details.</p></AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger><span class="vds-heading-3">Billing Address</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Street address, city, state, and zip code.</p></AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger><span class="vds-heading-3">Payment Method</span></AccordionTrigger>
<AccordionContent><p class="vds-paragraph-light">Credit card or PayPal account information.</p></AccordionContent>
</AccordionItem>
</Accordion>