Accordion component organizes related content in a compact space that can be revealed and hidden.
import { Accordion } from "@kesko/components";
export default () => (
<>
<Accordion open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</Accordion>
<Accordion>
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</Accordion>
<Accordion>
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</Accordion>
</>
);<details class="k-accordion" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</details>
<details class="k-accordion">
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</details>
<details class="k-accordion">
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</details>import { useState } from "react";
import { Accordion, Button, Stack } from "@kesko/components";
export default () => {
const [open, setOpen] = useState(true);
return (
<Stack gap="sm">
<Button appearance="outline" onClick={() => setOpen(value => !value)}>
{open ? "Collapse" : "Expand"}
</Button>
<Accordion open={open} onToggle={event => setOpen(event.currentTarget.open)}>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</Accordion>
</Stack>
);
};<k-stack gap="sm">
<button class="k-button" appearance="outline">Collapse</button>
<details class="k-accordion" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</details>
</k-stack>import { Accordion } from "@kesko/components";
export default () => (
<Accordion disabled>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</Accordion>
);<details class="k-accordion" disabled>
<summary aria-disabled="true" tabindex="-1">
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</details>import { Accordion } from "@kesko/components";
export default () => (
<>
<Accordion name="faq" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</Accordion>
<Accordion name="faq">
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</Accordion>
<Accordion name="faq">
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</Accordion>
</>
);<details class="k-accordion" name="faq" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</details>
<details class="k-accordion" name="faq">
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</details>
<details class="k-accordion" name="faq">
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</details>import { Accordion, Stack } from "@kesko/components";
export default () => (
<Stack gap="sm">
<Accordion variant="panel" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</Accordion>
<Accordion variant="panel">
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</Accordion>
<Accordion variant="panel">
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</Accordion>
</Stack>
);<k-stack gap="sm">
<details class="k-accordion" variant="panel" open>
<summary>
<h3>Delivery</h3>
</summary>
<p>Orders placed before noon are delivered the same day. Choose a two-hour slot at checkout.</p>
</details>
<details class="k-accordion" variant="panel">
<summary>
<h3>Returns</h3>
</summary>
<p>Return unopened products within 14 days to any K-Ruoka store or through the courier.</p>
</details>
<details class="k-accordion" variant="panel">
<summary>
<h3>Payment</h3>
</summary>
<p>We accept cards, MobilePay and invoice. K-Plussa points are added to every purchase.</p>
</details>
</k-stack>import { Accordion, Stack } from "@kesko/components";
export default () => (
<Stack gap="lg" alignment="stretch">
<Stack gap="2xs">
<span className="k-text-sm">Medium</span>
<Accordion variant="panel" open>
<summary>
<h3>Basic information</h3>
</summary>
<p>Registered in September 2026 with 4 000 km on the clock, located at K-Auto Tampere.</p>
</Accordion>
</Stack>
<Stack gap="2xs">
<span className="k-text-sm">Small</span>
<Accordion variant="panel" size="sm" open>
<summary>
<h3>Basic information</h3>
</summary>
<p>Registered in September 2026 with 4 000 km on the clock, located at K-Auto Tampere.</p>
</Accordion>
</Stack>
</Stack>
);<k-stack gap="lg" alignment="stretch">
<k-stack gap="2xs">
<span class="k-text-sm">Medium</span>
<details class="k-accordion" variant="panel" open>
<summary>
<h3>Basic information</h3>
</summary>
<p>Registered in September 2026 with 4 000 km on the clock, located at K-Auto Tampere.</p>
</details>
</k-stack>
<k-stack gap="2xs">
<span class="k-text-sm">Small</span>
<details class="k-accordion k-accordion-sm" variant="panel" open>
<summary>
<h3>Basic information</h3>
</summary>
<p>Registered in September 2026 with 4 000 km on the clock, located at K-Auto Tampere.</p>
</details>
</k-stack>
</k-stack>import { Accordion, Button } from "@kesko/components";
export default () => (
<Accordion size="sm" lang="fi" open style={{ "--k-accordion-text": "var(--k-color-text-base)" }}>
<summary>
<h3>Miksi toisin autoni valtuutettuun merkkihuoltoon?</h3>
</summary>
<p>
Valtuutettu merkkihuolto tarkoittaa huoltoa, jonka autonvalmistaja on hyväksynyt. Huollossa käytetään valmistajan
määrittelemiä huoltomenetelmiä, ohjelmistoja ja alkuperäisiä varaosia, ja huolto kirjautuu auton viralliseen
huoltohistoriaan.
</p>
<p>
Huollattamalla autosi merkkihuollossa varmistatkin, että autosi huolletaan aina valmistajan tuoreimpien ohjeiden
ja vaatimusten mukaisesti. Merkkihuollossa käytetään vain valmistajan hyväksymiä työkaluja, työtapoja ja
varaosia.
</p>
<p>Kun olet myymässä autoasi, merkkihuollon leima huoltokirjassa kertoo, että autosta on pidetty asianmukaista huolta.</p>
<Button href="https://www.k-auto.fi/huolto/">Varaa huolto</Button>
</Accordion>
);<details class="k-accordion k-accordion-sm" lang="fi" open style="--k-accordion-text: var(--k-color-text-base)">
<summary>
<h3>Miksi toisin autoni valtuutettuun merkkihuoltoon?</h3>
</summary>
<p>
Valtuutettu merkkihuolto tarkoittaa huoltoa, jonka autonvalmistaja on hyväksynyt. Huollossa käytetään valmistajan määrittelemiä huoltomenetelmiä, ohjelmistoja ja alkuperäisiä varaosia, ja huolto kirjautuu auton viralliseen huoltohistoriaan.
</p>
<p>
Huollattamalla autosi merkkihuollossa varmistatkin, että autosi huolletaan aina valmistajan tuoreimpien ohjeiden ja vaatimusten mukaisesti. Merkkihuollossa käytetään vain valmistajan hyväksymiä työkaluja, työtapoja ja varaosia.
</p>
<p>Kun olet myymässä autoasi, merkkihuollon leima huoltokirjassa kertoo, että autosta on pidetty asianmukaista huolta.</p>
<a class="k-button" href="https://www.k-auto.fi/huolto/">Varaa huolto</a>
</details>import { Accordion, Badge } from "@kesko/components";
import { IconHeart } from "@kesko/iconography/react";
export default () => (
<Accordion open>
<summary>
<h3>
<IconHeart /> Favourites
</h3>
<Badge>4</Badge>
</summary>
<p>Salted butter, oat milk, rye bread and coffee are on your favourites list.</p>
</Accordion>
);<details class="k-accordion" open>
<summary>
<h3><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.852 4.673c-2.432-2.265-6.365-2.153-8.767.25l-.083.082-.082-.082c-2.402-2.403-6.338-2.515-8.768-.25C.595 7.053.52 11.196 2.99 13.667l8.307 8.31c.39.39 1.025.39 1.415 0l8.308-8.307c2.471-2.471 2.396-6.615-.163-8.995zm-.897 7.937L12 20.565 4.045 12.61c-1.881-1.881-1.816-5.027.125-6.84 1.845-1.72 4.845-1.625 6.685.215l.862.863c.155.155.41.155.565 0l.863-.863c1.84-1.837 4.837-1.935 6.685-.215 1.941 1.809 2.007 4.96.125 6.837z" fill="currentColor" /></svg> Favourites</h3>
<k-badge>4</k-badge>
</summary>
<p>Salted butter, oat milk, rye bread and coffee are on your favourites list.</p>
</details>import { Accordion } from "@kesko/components";
const rows = [
["Registration number", "ABC-123"],
["First registration", "11.9.2026"],
["Mileage", "4 000 km"],
["Colour", "Grey"],
["Location", "K-Auto Tampere"],
["Body type", "SUV"],
["Transmission", "Automatic"],
];
export default () => (
<Accordion variant="panel" open>
<summary>
<h3>Basic information</h3>
</summary>
<table style={{ inlineSize: "100%", borderCollapse: "collapse" }}>
<tbody>
{rows.map(([label, value]) => (
<tr key={label} className="k-border-b k-border-divider">
<th scope="row" className="k-py-sm" style={{ textAlign: "start", fontWeight: "normal" }}>
{label}
</th>
<td className="k-py-sm">
<strong>{value}</strong>
</td>
</tr>
))}
</tbody>
</table>
</Accordion>
);<details class="k-accordion" variant="panel" open>
<summary>
<h3>Basic information</h3>
</summary>
<table style="inline-size: 100%; border-collapse: collapse">
<tbody>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Registration number</th>
<td class="k-py-sm"><strong>ABC-123</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">First registration</th>
<td class="k-py-sm"><strong>11.9.2026</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Mileage</th>
<td class="k-py-sm"><strong>4 000 km</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Colour</th>
<td class="k-py-sm"><strong>Grey</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Location</th>
<td class="k-py-sm"><strong>K-Auto Tampere</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Body type</th>
<td class="k-py-sm"><strong>SUV</strong></td>
</tr>
<tr class="k-border-b k-border-divider">
<th scope="row" class="k-py-sm" style="text-align: start; font-weight: normal">Transmission</th>
<td class="k-py-sm"><strong>Automatic</strong></td>
</tr>
</tbody>
</table>
</details>Properties #
| Name | Description | Type | Default |
|---|---|---|---|
variant | The style variant of the accordion. | "plain" | "panel" | "plain" |
size | The size of the accordion. | "sm" | "md" | "md" |
open | Whether the panel is expanded. Pair it with | boolean | — |
disabled | Disables the component. The summary stays visible but is marked | boolean | — |
name | Accordions that share a | string | — |
Events #
| Name | Description | Type |
|---|---|---|
onToggle | Called after the panel has opened or closed. Read | (event: SyntheticEvent<HTMLDetailsElement>) => void |
Styles #
CSS custom properties provide finer-grained control than properties. See Styling API for more details. Prefer the Properties API when it suits your need.
| Name | Description | Default |
|---|---|---|
--k-accordion-radius | Overrides the border radius of the panel variant. | var(--k-radius-panel) |
--k-accordion-bg | Overrides the background color. The panel variant defaults to | transparent |
--k-accordion-border | Overrides the divider color. The panel variant defaults to | var(--k-color-border-divider) |
--k-accordion-text | Overrides the title color. The chevron keeps the primary color of the variant. | var(--k-color-text-primary) |
Accessibility #
Accordion is built on a native <details> element with <summary> as the trigger, so the browser provides the button role, the expanded state and Enter and Space activation.
- Put a heading in the summary. Every level from
h1toh6looks the same, so pick the one that follows the heading above the accordion. Some screen readers announce the summary as a button only, which is why the words have to work without the heading semantics. - Say what the panel holds. Screen readers read the
<summary>as the name of the trigger: a leading icon is skipped, and a Badge count is read as part of it. “Favourites, 4” works; an icon with no words doesn’t. - Keep controls out of the summary. A link or a button inside it competes with the trigger. Put actions in the panel.
- Disable sparingly.
disabledkeeps the title readable, marks the summaryaria-disabledand takes it out of the tab order. In plain HTML the summary also needsaria-disabled="true"andtabindex="-1", and a script that focuses it can still toggle it. If the content is simply unavailable, leave the accordion out instead. - Group with
nameonly for optional content. Accordions sharing anameclose each other without moving focus. Do not use that for steps a person has to complete in order. - Do not hide what people must see. A closed panel is not announced. Required inputs and error messages belong outside the accordion.
- Check contrast if you override colors.
--k-accordion-textneeds 4.5:1 against--k-accordion-bg. Verify with the WebAIM contrast checker.
See the accessibility guidelines and the A11Y checklist for more details.
Usage #
There are two necessary parts to using the Accordion component. The @kesko/components package and the CSS Framework are required. Everything else is optional:
npm install @kesko/components @kesko/csspnpm add @kesko/components @kesko/cssyarn add @kesko/components @kesko/cssbun add @kesko/components @kesko/cssOnce installed, load the CSS Framework in your app’s entry point or root layout:
import "@kesko/css";Then, you can import the Accordion:
import { Accordion } from "@kesko/components";Projects without React can get the same styles from @kesko/css by importing the components stylesheet as well:
@import "@kesko/css";
@import "@kesko/css/components";Resources #
Usage guidelines
Learn how to use the component library with React, Next.js, or basic HTML.
Localization
How to translate the components for multiple languages.
CSS Framework
Utilities and tokens for everything the components don’t cover.
Themes
How to customize the component library theme.
Accessibility checklist
Interactive, browser-based Kesko accessibility checklist.