
# Migration to 3.0.0 icons

> This guide will help you understand how to transition an existing project from using the 2.x version of Kesko Design System’s icons to using the latest 3.0.0 version.

## What’s changing?

The `size` prop of the React components now uses the same scale as the [icon size tokens](/tokens/#sizes), where `md` is the default 16px size. One icon is renamed to fix a typo, and the category slugs now match the category names. The release also adds new icons and redraws some of the existing ones. Import paths and the `label` and `color` props are unchanged.

---

## Updating dependencies

To migrate your application to use the latest Kesko Design System icons, update package.json with the necessary dependencies:

- Update existing `@kesko/iconography` to version `3.0.0`.

Here’s an example `package.json`:

```json
{
  "dependencies": {
    "@kesko/iconography": "^3.0.0"
  }
}
```

---

### Size scale

We’ve renamed the size values so that they match the design tokens. If you’re passing any of these values to the `size` prop, you should search and replace them so that your icons keep their size after the update. Every pixel size keeps its value:

| 2.x    | 3.0.0   | Size  |
| ------ | ------- | ----- |
| `"xs"` | `"md"`  | 16 px |
| `"sm"` | `"lg"`  | 20 px |
| `"md"` | `"xl"`  | 24 px |
| `"lg"` | `"2xl"` | 32 px |
| `"xl"` | `"3xl"` | 48 px |

Replace from the largest step down, so that an already renamed `"md"` is not picked up again. Numbers and CSS strings such as `size={40}` need no change.

The default is still `"md"`, which now means 16 px instead of 24 px. If you relied on the old default, add `size="xl"`:

```diff
- <IconCart />
+ <IconCart size="xl" />
```

### Renamed icon

We’ve renamed one icon to fix a typo in its name. If you’re using it, you should search and replace the name so that it continues working after the update:

| 2.x                     | 3.0.0                   |
| ----------------------- | ----------------------- |
| `cut-to-lenght-service` | `cut-to-length-service` |

The rename affects every way the icon can be referenced:

```diff
  // Individual React components: the component name and the file name change
- import IconCutToLenghtService from "@kesko/iconography/dist/react/IconCutToLenghtService.js";
+ import IconCutToLengthService from "@kesko/iconography/dist/react/IconCutToLengthService.js";

  // The Icon component: the name prop changes
- <Icon name="cut-to-lenght-service" />
+ <Icon name="cut-to-length-service" />

  // ES modules and raw SVG files: the file name changes
- import svg from "@kesko/iconography/dist/assets/cut-to-lenght-service.js";
+ import svg from "@kesko/iconography/dist/assets/cut-to-length-service.js";
```

### Category slugs

Category slugs now match the category names. This only affects code that reads icon metadata. If you never read `category` from `dist/icons.json` or `dist/icons.js`, and don’t use the `KeskoIconCategory` type, there is nothing you need to change:

| 2.x              | 3.0.0                              |
| ---------------- | ---------------------------------- |
| `filters`        | `lists-and-filters`                |
| `alerts`         | `notifications-and-alerts`         |
| `security`       | `passwords-and-safety`             |
| `location`       | `location-and-navigation`          |
| `contact`        | `contact-and-feedback`             |
| `shopping`       | `shops-and-shopping`               |
| `delivery`       | `pick-up-and-delivery`             |
| `seasons`        | `seasons-and-campaigns`            |
| `finance`        | `finance-and-contracts`            |
| `loyalty`        | `loyalty-programs`                 |
| `hardware`       | `hardware-and-renovation`          |
| `home`           | `home-and-garden`                  |
| `services`       | `shopping-categories-and-services` |
| `sustainability` | `environment-and-sustainability`   |
| `electronics`    | `electronics-and-telecom`          |

Eight icons have also moved to another category, so a filter built on one of these categories returns a slightly different set of icons:

| Icon               | 2.x                              | 3.0.0                            |
| ------------------ | -------------------------------- | -------------------------------- |
| `healthy-facility` | Home and garden                  | Shopping categories and services |
| `parking`          | Shopping categories and services | Automotive                       |
| `price`            | Shopping categories and services | Finance and contracts            |
| `robot`            | Pick-up and delivery             | Electronics and telecom          |
| `services`         | Shopping categories and services | Shops and shopping               |
| `sleep`            | Shopping categories and services | Environment and sustainability   |
| `stamp`            | Finance and contracts            | Loyalty programs                 |
| `wallpapers`       | Hardware and renovation          | Home and garden                  |

---

## New icons

The following icons are new in 3.0.0. You can browse them, and the rest of the library, on the [icons page](/icons/):

- `butter` (groceries)
- `double-chevron-left` (arrows)
- `double-chevron-right` (arrows)
- `egg` (groceries)
- `hand-pointer` (basic-ui)
- `keyboard` (electronics-and-telecom)
- `list-reset` (lists-and-filters)
- `moon` (environment-and-sustainability)
- `nuts-seeds` (groceries)
- `order-pickup-ready` (pick-up-and-delivery)
- `order-processing` (pick-up-and-delivery)
- `order-received` (pick-up-and-delivery)
- `order-sent` (pick-up-and-delivery)
- `peas` (groceries)
- `pin-code` (pick-up-and-delivery)
- `view-blocks` (lists-and-filters)

---

## Updated icons

The following icons have been redrawn. Their names are unchanged, so there is nothing you need to update, but it’s worth checking how they look in your product:

- `exclamation-mark`, `info-mark`, `question-mark`, `share` and `tick` are drawn larger, so that they fill the 24×24 grid.
- `alcohol` and `alcohol-free` no longer include the percent badge.
- `age-restricted` now reads K18 instead of K-18.
- `egg-free` now shows the yolk.
- `easter` has a closed outline.

---

## Getting support

Have a question about migration to `3.0.0`? Please head over to the [Support page](/help/) for more guidelines and ways to contact us.
