Button component for interface actions. Renders as a regular link when href is provided. Buttons should primarily be used to trigger events or actions.
import { Button, Stack } from "@kesko/components";
import { IconBasketAddTo, IconArrowRight, IconExternalLink } from "@kesko/iconography/react";
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button>
<IconBasketAddTo />
Primary
</Button>
<Button square>
<IconBasketAddTo label="Shopping basket" />
</Button>
<Button variant="secondary">
Secondary
<IconArrowRight />
</Button>
<Button variant="secondary" appearance="outline">Outline</Button>
<Button variant="secondary" appearance="plain" href="https://kesko.design" target="_blank">
Plain <IconExternalLink label="(Opens in a new window)" />
</Button>
<Button variant="secondary" appearance="text">Text</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Primary
</button>
<button class="k-button" square>
<svg role="img" aria-label="Shopping basket" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
</button>
<button class="k-button" variant="secondary" appearance="filled">
Secondary
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.777 12.293l-6.465 6.465a.401.401 0 0 1-.564 0l-.495-.495a.401.401 0 0 1 0-.566L17.2 12.75H5.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h11.78l-4.928-4.928a.401.401 0 0 1 0-.565l.495-.495a.401.401 0 0 1 .565 0l6.465 6.465a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
</button>
<button class="k-button" variant="secondary" appearance="outline">Outline</button>
<a class="k-button" href="https://kesko.design" target="_blank" variant="secondary" appearance="plain">
Plain
<svg role="img" aria-label="(Opens in a new window)" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 13.15v5.1c0 .968-.782 1.75-1.75 1.75H4.75C3.782 20 3 19.218 3 18.25V7.75C3 6.782 3.782 6 4.75 6h5.1c.22 0 .4.18.4.4v.7c0 .22-.18.4-.4.4h-5.1a.25.25 0 0 0-.25.25v10.5c0 .138.113.25.25.25h14.5a.25.25 0 0 0 .25-.25v-5.1c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4zm1.278-6.933l-3.465-3.464a.401.401 0 0 0-.565 0l-.496.495a.401.401 0 0 0 0 .565L19.69 5.75H18a6.75 6.75 0 0 0-6.75 6.75v.1c0 .22.18.4.4.4h.7c.22 0 .4-.18.4-.4v-.1c0-2.9 2.35-5.25 5.25-5.25h1.69l-1.938 1.938a.401.401 0 0 0 0 .564l.495.495c.155.155.41.155.565 0l3.465-3.465a.401.401 0 0 0 0-.565z" fill="currentColor" /></svg>
</a>
<button class="k-button" variant="secondary" appearance="text">Text</button>
</k-stack>import { Button, Stack } from "@kesko/components";
import { IconClear, IconTick } from "@kesko/iconography/react";
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button variant="success">
<IconTick /> Accept
</Button>
<Button variant="error">
<IconClear /> Decline
</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button" variant="success" appearance="filled">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11 16a.745.745 0 0 1-.545-.235L6.73 11.807a.4.4 0 0 1 .018-.564l.51-.48a.4.4 0 0 1 .565.017l3.142 3.34 5.202-6.288a.398.398 0 0 1 .563-.052l.54.447c.17.14.195.393.052.563l-5.745 6.943a.759.759 0 0 1-.555.272h-.025z" fill="currentColor" /></svg>
Accept
</button>
<button class="k-button" variant="error" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.247 16.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-4.188 4.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 6.752 7.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l4.187-4.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
Decline
</button>
</k-stack>import { Button, Stack } from "@kesko/components";
import { IconExternalLink, IconDownload } from "@kesko/iconography/react";
export default () => (
<Stack direction="row" align="center">
<Button variant="secondary" appearance="outline" href="https://kesko.design" target="_blank">
External link <IconExternalLink label="(Opens in a new window)" />
</Button>
<Button variant="secondary" appearance="text" href="/file.pdf" download>
Download PDF <IconDownload />
</Button>
</Stack>
);<k-stack direction="row" align="center">
<a class="k-button" href="https://kesko.design" target="_blank" variant="secondary" appearance="outline">
External link
<svg role="img" aria-label="(Opens in a new window)" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 13.15v5.1c0 .968-.782 1.75-1.75 1.75H4.75C3.782 20 3 19.218 3 18.25V7.75C3 6.782 3.782 6 4.75 6h5.1c.22 0 .4.18.4.4v.7c0 .22-.18.4-.4.4h-5.1a.25.25 0 0 0-.25.25v10.5c0 .138.113.25.25.25h14.5a.25.25 0 0 0 .25-.25v-5.1c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4zm1.278-6.933l-3.465-3.464a.401.401 0 0 0-.565 0l-.496.495a.401.401 0 0 0 0 .565L19.69 5.75H18a6.75 6.75 0 0 0-6.75 6.75v.1c0 .22.18.4.4.4h.7c.22 0 .4-.18.4-.4v-.1c0-2.9 2.35-5.25 5.25-5.25h1.69l-1.938 1.938a.401.401 0 0 0 0 .564l.495.495c.155.155.41.155.565 0l3.465-3.465a.401.401 0 0 0 0-.565z" fill="currentColor" /></svg>
</a>
<a class="k-button" href="/file.pdf" download variant="secondary" appearance="text">
Download PDF
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.962 15.235C22.637 17.978 20.23 20 17.467 20H15.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.077c2.015 0 3.78-1.477 3.998-3.48a3.906 3.906 0 0 0-2.32-4.01.767.767 0 0 1-.47-.757c.007-.105.018-.213.018-.32a3.914 3.914 0 0 0-3.91-3.91c-1.39 0-2.688.752-3.386 1.962a.754.754 0 0 1-1.048.26 2.208 2.208 0 0 0-.814-.33 2.047 2.047 0 0 0-2.388 1.99.801.801 0 0 1-.772.778 3.913 3.913 0 0 0-3.875 4.21c.15 1.99 2 3.61 3.995 3.61H8.6c.22 0 .4.18.4.4v.7c0 .22-.18.4-.4.4H6.537c-2.942 0-5.442-2.298-5.535-5.24A5.419 5.419 0 0 1 5.73 9.224a3.553 3.553 0 0 1 4.782-2.588 5.427 5.427 0 0 1 4.283-2.112 5.413 5.413 0 0 1 5.407 5.332 5.41 5.41 0 0 1 2.758 5.38zm-7.715-1.738l-.495-.495a.401.401 0 0 0-.565 0L12.75 14.44V10.4c0-.22-.18-.4-.4-.4h-.7c-.22 0-.4.18-.4.4v4.04l-1.438-1.438a.401.401 0 0 0-.564 0l-.495.495a.401.401 0 0 0 0 .565l2.965 2.965c.155.155.41.155.565 0l2.965-2.965a.401.401 0 0 0 0-.565z" fill="currentColor" /></svg>
</a>
</k-stack>import type { CSSProperties } from "react";
import { Button, Stack } from "@kesko/components";
const info = {
"--k-button-bg": "var(--k-color-status-info)",
"--k-button-text": "var(--k-color-text-on-info)",
"--k-button-bg-hover": "var(--k-color-highlight-info)",
} as CSSProperties;
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button style={info}>Info</Button>
<Button appearance="outline" style={{ "--k-button-radius": "var(--k-radius-md)" } as CSSProperties}>
Rounded corners
</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button" style="--k-button-bg: var(--k-color-status-info); --k-button-text: var(--k-color-text-on-info); --k-button-bg-hover: var(--k-color-highlight-info);">Info</button>
<button class="k-button" style="--k-button-radius: var(--k-radius-md);" appearance="outline">Rounded corners</button>
</k-stack>import { Button, Stack } from "@kesko/components";
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button disabled>Filled</Button>
<Button appearance="outline" disabled>Outline</Button>
<Button appearance="plain" disabled>Plain</Button>
<Button appearance="text" disabled>Text</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button" disabled>Filled</button>
<button class="k-button" appearance="outline" disabled>Outline</button>
<button class="k-button" appearance="plain" disabled>Plain</button>
<button class="k-button" appearance="text" disabled>Text</button>
</k-stack>import { Button } from "@kesko/components";
export default () => (
<Button onClick={() => alert("Clicked!")}>Click me</Button>
);<button class="k-button" onclick="alert('Clicked!')">
Click me
</button>import { Button, Stack } from "@kesko/components";
import { IconArrowUp } from "@kesko/iconography/react";
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button expand>Full width</Button>
<Button expand>
Back to top <IconArrowUp />
</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button" expand>Full width</button>
<button class="k-button" expand>
Back to top
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.758 12.252l-.495.495a.401.401 0 0 1-.566 0L12.75 7.8v11.8c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4V7.82l-4.928 4.928a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565l6.465-6.465a.401.401 0 0 1 .565 0l6.465 6.465a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
</button>
</k-stack>import { Button, Stack } from "@kesko/components";
export default () => (
<form onSubmit={event => event.preventDefault()}>
<Stack direction="row" gap="2xs" align="center">
<Button type="submit">Save</Button>
<Button type="reset" variant="secondary" appearance="outline">
Reset
</Button>
<Button type="submit" loading>
Saving
</Button>
</Stack>
</form>
);<form onsubmit="event.preventDefault()">
<k-stack direction="row" gap="2xs" align="center">
<button class="k-button" type="submit">Save</button>
<button class="k-button" variant="secondary" appearance="outline" type="reset">Reset</button>
<button class="k-button" type="submit" loading aria-disabled="true" onclick="event.preventDefault()">
<k-spinner aria-hidden="true"></k-spinner>
Saving
<k-visually-hidden role="status">Loading</k-visually-hidden>
</button>
</k-stack>
</form>import { Button, Stack } from "@kesko/components";
export default () => (
<Stack direction="row" gap="2xs" align="center">
<Button size="lg" loading>Loading</Button>
<Button size="md" loading>Loading</Button>
<Button size="sm" loading>Loading</Button>
</Stack>
);<k-stack direction="row" gap="2xs" align="center">
<button class="k-button k-button-lg" loading aria-disabled="true" onclick="event.preventDefault()">
<k-spinner aria-hidden="true" size="lg"></k-spinner>
Loading
<k-visually-hidden role="status">Loading</k-visually-hidden>
</button>
<button class="k-button" loading aria-disabled="true" onclick="event.preventDefault()">
<k-spinner aria-hidden="true"></k-spinner>
Loading
<k-visually-hidden role="status">Loading</k-visually-hidden>
</button>
<button class="k-button k-button-sm" loading aria-disabled="true" onclick="event.preventDefault()">
<k-spinner aria-hidden="true" size="sm"></k-spinner>
Loading
<k-visually-hidden role="status">Loading</k-visually-hidden>
</button>
</k-stack>import { Button } from "@kesko/components";
import { IconBasketAddTo } from "@kesko/iconography/react";
export default () => (
<div
style={{ display: "grid",
gridTemplateColumns: "max-content repeat(4, max-content)",
gap: "var(--k-space-2xs) var(--k-space-sm)",
alignItems: "center",
justifyItems: "start",
}}
>
<span className="k-text-sm">Large</span>
<Button appearance="filled" size="lg">
<IconBasketAddTo /> Filled
</Button>
<Button appearance="outline" size="lg">
<IconBasketAddTo /> Outline
</Button>
<Button appearance="plain" size="lg">
<IconBasketAddTo /> Plain
</Button>
<Button size="lg" square>
<IconBasketAddTo label="Add to basket" />
</Button>
<span className="k-text-sm">Medium</span>
<Button appearance="filled">
<IconBasketAddTo /> Filled
</Button>
<Button appearance="outline">
<IconBasketAddTo /> Outline
</Button>
<Button appearance="plain">
<IconBasketAddTo /> Plain
</Button>
<Button square>
<IconBasketAddTo label="Add to basket" />
</Button>
<span className="k-text-sm">Small</span>
<Button appearance="filled" size="sm">
<IconBasketAddTo /> Filled
</Button>
<Button appearance="outline" size="sm">
<IconBasketAddTo /> Outline
</Button>
<Button appearance="plain" size="sm">
<IconBasketAddTo /> Plain
</Button>
<Button size="sm" square>
<IconBasketAddTo label="Add to basket" />
</Button>
</div>
);<div style="display: grid; grid-template-columns: max-content repeat(4, max-content); gap: var(--k-space-2xs) var(--k-space-sm); align-items: center; justify-items: start;">
<span class="k-text-sm">Large</span>
<button class="k-button" size="lg">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" size="lg" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" size="lg" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" size="lg" square>
<svg role="img" aria-label="Add to basket" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
</button>
<span class="k-text-sm">Medium</span>
<button class="k-button">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" square>
<svg role="img" aria-label="Add to basket" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
</button>
<span class="k-text-sm">Small</span>
<button class="k-button" size="sm">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" size="sm" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" size="sm" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" size="sm" square>
<svg role="img" aria-label="Add to basket" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
</button>
</div>import { Button } from "@kesko/components";
import { IconBasketAddTo } from "@kesko/iconography/react";
export default () => (
<div style={{
display: "grid",
gridTemplateColumns: "max-content repeat(4, max-content)",
gap: "var(--k-space-2xs) var(--k-space-sm)",
alignItems: "center",
justifyItems: "start",
}}
>
<span className="k-text-sm">Primary</span>
<Button>
<IconBasketAddTo /> Filled
</Button>
<Button appearance="outline">
<IconBasketAddTo /> Outline
</Button>
<Button appearance="plain">
<IconBasketAddTo /> Plain
</Button>
<Button appearance="text">
<IconBasketAddTo /> Text
</Button>
<span className="k-text-sm">Secondary</span>
<Button variant="secondary">
<IconBasketAddTo /> Filled
</Button>
<Button variant="secondary" appearance="outline">
<IconBasketAddTo /> Outline
</Button>
<Button variant="secondary" appearance="plain">
<IconBasketAddTo /> Plain
</Button>
<Button variant="secondary" appearance="text">
<IconBasketAddTo /> Text
</Button>
<div
style={{
gridColumn: "1 / -1",
display: "grid",
gridTemplateColumns: "subgrid",
alignItems: "center",
padding: "var(--k-space-sm)",
marginInline: "calc(-1 * var(--k-space-sm))",
borderRadius: "var(--k-radius-md)",
background: "var(--k-color-bg-inverted)",
color: "var(--k-color-text-inverted)",
}}
>
<span className="k-text-sm">Neutral</span>
<Button variant="neutral">
<IconBasketAddTo /> Filled
</Button>
<Button variant="neutral" appearance="outline">
<IconBasketAddTo /> Outline
</Button>
<Button variant="neutral" appearance="plain">
<IconBasketAddTo /> Plain
</Button>
<Button variant="neutral" appearance="text">
<IconBasketAddTo /> Text
</Button>
</div>
</div>
);<div style="display: grid; grid-template-columns: max-content repeat(4, max-content); gap: var(--k-space-2xs) var(--k-space-sm); align-items: center; justify-items: start;">
<span class="k-text-sm">Primary</span>
<button class="k-button">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" appearance="text">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Text
</button>
<span class="k-text-sm">Secondary</span>
<button class="k-button" variant="secondary" appearance="filled">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" variant="secondary" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" variant="secondary" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" variant="secondary" appearance="text">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Text
</button>
<div style="grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding: var(--k-space-sm); margin-inline: calc(-1 * var(--k-space-sm)); border-radius: var(--k-radius-md); background: var(--k-color-bg-inverted); color: var(--k-color-text-inverted);">
<span class="k-text-sm">Neutral</span>
<button class="k-button" variant="neutral" appearance="filled">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Filled
</button>
<button class="k-button" variant="neutral" appearance="outline">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Outline
</button>
<button class="k-button" variant="neutral" appearance="plain">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Plain
</button>
<button class="k-button" variant="neutral" appearance="text">
<svg aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22 18.65v.7c0 .22-.18.4-.4.4h-2.85v2.85c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-2.85H14.4c-.22 0-.4-.18-.4-.4v-.7c0-.22.18-.4.4-.4h2.85V15.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v2.85h2.85c.22 0 .4.18.4.4zM12 19.9v.7c0 .22-.18.4-.4.4H5.787c-.81 0-1.512-.555-1.702-1.343L1.27 7.925A.757.757 0 0 1 2 7h5c.061-2.716 2.347-5.047 5.092-5 2.705.05 4.905 2.292 4.905 5v.75c0 .415-.335.75-.75.75H2.952l2.595 10.807a.25.25 0 0 0 .243.193h5.812c.22 0 .4.18.4.4zM8.502 7H15.5a3.516 3.516 0 0 0-3.433-3.5c-1.914-.037-3.509 1.612-3.565 3.497zM22 7h-2.6c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4h1.647l-1.185 4.935a.4.4 0 0 0 .295.482l.68.163a.4.4 0 0 0 .483-.295l1.407-5.86A.752.752 0 0 0 22 7z" fill="currentColor" /></svg>
Text
</button>
</div>
</div>Properties
| Name | Description | Type | Default |
|---|---|---|---|
variant | The style variant of the button. | "primary" | "secondary" | "neutral" | "success" | "error" | "primary" |
appearance | The appearance of the button. Defaults to | "filled" | "outline" | "plain" | "text" | — |
size | The size of the button. | "sm" | "md" | "lg" | "md" |
expand | Makes the button fit its container. | boolean | false |
disabled | Disables the component. Native | boolean | false |
loading | Shows a spinner and blocks activation with | boolean | — |
loadingLabel | Text announced by screen readers when | string | — |
square | Forces a 1:1 aspect ratio at the size's height, for icon-only buttons and single characters such as page numbers. An icon-only button needs an accessible name: set | boolean | false |
aria-label | Accessible name. Icon-only ( | string | — |
aria-labelledby |
| string | — |
aria-describedby |
| string | — |
type | The type of the button. | "submit" | "reset" | "button" | "button" |
aria-controls |
| string | — |
aria-expanded | Whether a grouping controlled by this button is expanded. | boolean | "true" | "false" | — |
aria-haspopup | Availability and type of popup this button opens. | boolean | "menu" | "listbox" | "tree" | "grid" | "dialog" | "true" | "false" | — |
href | Renders as an anchor element. | string | — |
target | Where to open the linked URL. | "_self" | "_blank" | "_parent" | "_top" | — |
download | Triggers a file download. Pass | boolean | string | — |
Events
| Name | Description | Type |
|---|---|---|
onClick | Handler called on click (mouse, touch, or keyboard activation). | (event: MouseEvent<ButtonTarget>) => void |
onFocus | Handler called when the element receives focus. | (event: FocusEvent<ButtonTarget>) => void |
onBlur | Handler called when the element loses focus. | (event: FocusEvent<ButtonTarget>) => void |
Styles
CSS custom properties provide finer-grained control than props. Prefer the props API when it suits your need.
| Name | Description | Default |
|---|---|---|
--k-button-bg | Overrides the background color. | var(--k-color-theme-primary) |
--k-button-text | Overrides the text color. | var(--k-color-text-on-primary) |
--k-button-border | Overrides the border color. | transparent |
--k-button-bg-hover | Overrides the hover and pressed background color. | var(--k-color-highlight-primary) |
--k-button-text-hover | Overrides the hover and pressed text color. | var(--k-button-text) |
--k-button-border-hover | Overrides the hover and pressed border color. | transparent |
--k-button-radius | Overrides the border radius. | var(--k-radius-button) |
--k-button-focus | Overrides the focus ring color. | var(--k-color-border-focus) |
--k-button-height | Overrides the button height. | calc(line-height + 2 * padding) |
Accessibility #
Under the hood this is a native <button>, or an <a> when you pass a href, so it behaves as people and assistive technologies expect.
- Use
hreffor navigation. Screen readers announce a link as going somewhere and a button as doing something. Do not navigate fromonClick. In Next.js or React Router, wrap your app once inKeskoProviderwith the router's navigate function, and links change pages without a full reload. - Give icon-only buttons a label. Pass
aria-label, or setlabelon the icon. That text is what a screen reader reads out. - Keep the meaning in the label. The error variant marks a risky action for people who see red. The label has to mark it for everyone, for example “Poista tilaus” rather than “Vahvista”.
- Say what happens. Screen reader users often jump from button to button and hear only the labels, so “Lue lisää” or “Klikkaa tästä” mean nothing on their own. Name the outcome, for example “Näytä tilaushistoria”.
- Avoid
disabled. A disabled button leaves the tab order and cannot explain itself. Keep it enabled and validate on click. If you must disable it, use the provided prop, not CSS: it setsdisabledoraria-disabledfor you. - Use
loadingfor short waits. It blocks the button, keeps its size and renders a status spinner that screen readers announce. Show longer progress elsewhere. - Announce bulk waits once. When many buttons load together, for example one per table row, every region would speak. Pass
loadingLabel=""to those buttons and announce the wait once in a status region of your own. - Check contrast when you override colors. Text needs 4.5:1 against
--k-button-bg, and--k-button-focusneeds 3:1 against the surface the button sits on. Do not override the sizes: the small size is already the minimum target.
See the accessibility guidelines and the A11Y checklist for more details.
Usage #
There are two necessary parts to using the Button 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 Button:
import { Button } 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.