
# Select



> Select component allows users to choose one option from a list of options. Consider using the Select component when you have 6 or more options.

## Examples

### Default

```tsx
import { Select } from "@kesko/components";

export default () => (
  <Select label="Store" name="store" placeholder="Choose a store">
    <option value="sello">K-Citymarket Sello</option>
    <option value="kamppi">K-Supermarket Kamppi</option>
    <option value="toolo">K-Market Töölö</option>
  </Select>
);

```

```html
<k-select>
  <label class="k-label" for="store">Store</label>
  <div class="k-field">
    <select id="store" name="store">
      <option value="">Choose a store</option>
      <option value="sello">K-Citymarket Sello</option>
      <option value="kamppi">K-Supermarket Kamppi</option>
      <option value="toolo">K-Market Töölö</option>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
</k-select>
```

### Assistive text

```tsx
import { Select } from "@kesko/components";

export default () => (
  <Select
    label="Receipt"
    name="receipt"
    defaultValue="email"
    description="Where we send the receipt after each purchase."
  >
    <option value="email">By email</option>
    <option value="app">In the K-Ruoka app</option>
    <option value="paper">Printed at the checkout</option>
  </Select>
);

```

```html
<k-select>
  <label class="k-label" for="receipt">Receipt</label>
  <div class="k-field">
    <select id="receipt" name="receipt" aria-describedby="receipt-description">
      <option value="email" selected>By email</option>
      <option value="app">In the K-Ruoka app</option>
      <option value="paper">Printed at the checkout</option>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
  <p class="k-field-description" id="receipt-description">Where we send the receipt after each purchase.</p>
</k-select>
```

### Custom label style

```tsx
import { Select } from "@kesko/components";

const subtle = {
  "--k-label-text": "var(--k-color-text-dim)",
  "--k-label-weight": "var(--k-font-weight-medium)",
  "--k-label-required": "var(--k-color-status-error)",
};

export default () => (
  <Select label="Custom label" name="custom" placeholder="Choose an option" required style={subtle}>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
  </Select>
);

```

```html
<k-select
  style="
    --k-label-text: var(--k-color-text-dim);
    --k-label-weight: var(--k-font-weight-medium);
    --k-label-required: var(--k-color-status-error);"
>
  <label class="k-label" for="custom">Custom label<span class="k-label-required" aria-hidden="true">*</span></label>
  <div class="k-field">
    <select id="custom" name="custom" required>
      <option value="">Choose an option</option>
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
</k-select>
```

### Custom width

```tsx
import { Select, Stack } from "@kesko/components";

export default () => (
  <Stack direction="row">
    <Select label="Quantity" name="quantity" defaultValue="1" style={{ "--k-select-inline-size": "6rem" }}>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
    </Select>
    <Select label="Unit" name="unit" defaultValue="kg" style={{ "--k-select-inline-size": "8rem" }}>
      <option value="kg">kg</option>
      <option value="g">g</option>
      <option value="pcs">pcs</option>
    </Select>
    <Select label="Store" name="store" placeholder="Choose a store" style={{ "--k-select-inline-size": "16rem" }}>
      <option value="sello">K-Citymarket Sello</option>
      <option value="kamppi">K-Supermarket Kamppi</option>
    </Select>
  </Stack>
);

```

```html
<k-stack direction="row">
  <k-select style="--k-select-inline-size: 6rem;">
    <label class="k-label" for="quantity">Quantity</label>
    <div class="k-field">
      <select id="quantity" name="quantity">
        <option value="1" selected>1</option>
        <option value="2">2</option>
        <option value="3">3</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select style="--k-select-inline-size: 8rem;">
    <label class="k-label" for="unit">Unit</label>
    <div class="k-field">
      <select id="unit" name="unit">
        <option value="kg" selected>kg</option>
        <option value="g">g</option>
        <option value="pcs">pcs</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select style="--k-select-inline-size: 16rem;">
    <label class="k-label" for="store">Store</label>
    <div class="k-field">
      <select id="store" name="store">
        <option value="">Choose a store</option>
        <option value="sello">K-Citymarket Sello</option>
        <option value="kamppi">K-Supermarket Kamppi</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
</k-stack>
```

### Preselected value

```tsx
import { Select } from "@kesko/components";

export default () => (
  <Select label="Delivery method" name="delivery" defaultValue="pickup">
    <option value="home">Home delivery</option>
    <option value="pickup">Pickup from store</option>
    <option value="locker">Parcel locker</option>
  </Select>
);

```

```html
<k-select>
  <label class="k-label" for="delivery">Delivery method</label>
  <div class="k-field">
    <select id="delivery" name="delivery">
      <option value="home">Home delivery</option>
      <option value="pickup" selected>Pickup from store</option>
      <option value="locker">Parcel locker</option>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
</k-select>
```

### Disabled

```tsx
import { Select, Stack } from "@kesko/components";

export default () => (
  <Stack>
    <Select label="Store" name="store" defaultValue="sello" disabled>
      <option value="sello">K-Citymarket Sello</option>
      <option value="kamppi">K-Supermarket Kamppi</option>
    </Select>
    <Select label="Delivery slot" name="slot" placeholder="Choose a time">
      <option value="morning">8–12</option>
      <option value="afternoon" disabled>
        12–16 (full)
      </option>
      <option value="evening">16–20</option>
    </Select>
  </Stack>
);

```

```html
<k-stack>
  <k-select>
    <label class="k-label" for="store">Store</label>
    <div class="k-field">
      <select id="store" name="store" disabled>
        <option value="sello" selected>K-Citymarket Sello</option>
        <option value="kamppi">K-Supermarket Kamppi</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select>
    <label class="k-label" for="slot">Delivery slot</label>
    <div class="k-field">
      <select id="slot" name="slot">
        <option value="">Choose a time</option>
        <option value="morning">8–12</option>
        <option value="afternoon" disabled>12–16 (full)</option>
        <option value="evening">16–20</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
</k-stack>
```

### Option groups

```tsx
import { Select } from "@kesko/components";

export default () => (
  <Select label="Product" name="product" placeholder="Choose a product">
    <optgroup label="Fruit">
      <option value="apple">Apple</option>
      <option value="banana">Banana</option>
    </optgroup>
    <optgroup label="Vegetables">
      <option value="carrot">Carrot</option>
      <option value="cucumber">Cucumber</option>
    </optgroup>
  </Select>
);

```

```html
<k-select>
  <label class="k-label" for="product">Product</label>
  <div class="k-field">
    <select id="product" name="product">
      <option value="">Choose a product</option>
      <optgroup label="Fruit">
        <option value="apple">Apple</option>
        <option value="banana">Banana</option>
      </optgroup>
      <optgroup label="Vegetables">
        <option value="carrot">Carrot</option>
        <option value="cucumber">Cucumber</option>
      </optgroup>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
</k-select>
```

### Hidden label

```tsx
import { Select } from "@kesko/components";

export default () => (
  <Select label="Sort by" hideLabel name="sort" defaultValue="relevance">
    <option value="relevance">Sort by relevance</option>
    <option value="price-asc">Sort by lowest price</option>
    <option value="price-desc">Sort by highest price</option>
  </Select>
);

```

```html
<k-select>
  <k-visually-hidden><label class="k-label" for="sort">Sort by</label></k-visually-hidden>
  <div class="k-field">
    <select id="sort" name="sort">
      <option value="relevance" selected>Sort by relevance</option>
      <option value="price-asc">Sort by lowest price</option>
      <option value="price-desc">Sort by highest price</option>
    </select>
    <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
  </div>
</k-select>
```

### Icon

```tsx
import { Select, Stack } from "@kesko/components";
import { IconCalendar, IconLocation } from "@kesko/iconography/react";

export default () => (
  <Stack>
    <Select label="Pickup store" name="store" placeholder="Choose a store">
      <IconLocation slot="start" />
      <option value="sello">K-Citymarket Sello</option>
      <option value="kamppi">K-Supermarket Kamppi</option>
      <option value="toolo">K-Market Töölö</option>
    </Select>
    <Select label="Delivery day" name="day" defaultValue="tue">
      <IconCalendar slot="start" />
      <option value="mon">Monday</option>
      <option value="tue">Tuesday</option>
      <option value="wed">Wednesday</option>
    </Select>
  </Stack>
);

```

```html
<k-stack>
  <k-select>
    <label class="k-label" for="store">Pickup store</label>
    <div class="k-field">
      <svg slot="start" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M12 13c-1.655 0-3-1.345-3-3s1.345-3 3-3 3 1.345 3 3-1.345 3-3 3zm0-4.5a1.501 1.501 0 0 0 0 3 1.501 1.501 0 0 0 0-3z" fill="currentColor" /><path d="M17.985 5.43l-.502.502a.401.401 0 0 0-.046.51c.673 1.023 1.065 2.245 1.065 3.558s-.367 2.48-1.052 3.535l-5.447 8.04-5.44-8.027A6.5 6.5 0 0 1 5.502 10c0-3.585 2.914-6.5 6.5-6.5 1.312 0 2.534.393 3.557 1.065.162.105.372.09.51-.045l.502-.502a.401.401 0 0 0-.057-.615 7.947 7.947 0 0 0-4.513-1.4c-4.412 0-8 3.59-8 8 0 1.544.45 3.054 1.31 4.374l6.068 8.955a.745.745 0 0 0 1.24 0l6.075-8.967A7.989 7.989 0 0 0 19.997 10a7.947 7.947 0 0 0-1.4-4.513.4.4 0 0 0-.615-.057z" fill="currentColor" /></svg>
      <select id="store" name="store">
        <option value="">Choose a store</option>
        <option value="sello">K-Citymarket Sello</option>
        <option value="kamppi">K-Supermarket Kamppi</option>
        <option value="toolo">K-Market Töölö</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select>
    <label class="k-label" for="day">Delivery day</label>
    <div class="k-field">
      <svg slot="start" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M22 4.75v14.5c0 .968-.782 1.75-1.75 1.75H3.75C2.782 21 2 20.218 2 19.25V10.4c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4v8.85c0 .138.112.25.25.25h16.5a.25.25 0 0 0 .25-.25V4.75a.25.25 0 0 0-.25-.25H17v.6c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-.6h-7v.6c0 .22-.18.4-.4.4h-.7c-.22 0-.4-.18-.4-.4v-.6H3.75a.25.25 0 0 0-.25.25V7h15.35c.22 0 .4.18.4.4v.7c0 .22-.18.4-.4.4H2.75A.749.749 0 0 1 2 7.75v-3C2 3.782 2.782 3 3.75 3H7v-.6c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4V3h7v-.6c0-.22.18-.4.4-.4h.7c.22 0 .4.18.4.4V3h3.25c.968 0 1.75.782 1.75 1.75zM11.4 11.5h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4h-1.2c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4zm5 0h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4h-1.2c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4zm-10 3h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4H6.4c-.22 0-.4.18-.4.4v.7c0 .22.18.4.4.4zm4.6-.4c0 .22.18.4.4.4h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4h-1.2c-.22 0-.4.18-.4.4zm5 0c0 .22.18.4.4.4h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4h-1.2c-.22 0-.4.18-.4.4zm-10 3c0 .22.18.4.4.4h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4H6.4c-.22 0-.4.18-.4.4zm5 0c0 .22.18.4.4.4h1.2c.22 0 .4-.18.4-.4v-.7c0-.22-.18-.4-.4-.4h-1.2c-.22 0-.4.18-.4.4z" fill="currentColor" /></svg>
      <select id="day" name="day">
        <option value="mon">Monday</option>
        <option value="tue" selected>Tuesday</option>
        <option value="wed">Wednesday</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
</k-stack>
```

### Required

```tsx
import { Select, Stack } from "@kesko/components";

export default () => (
  <Stack>
    <Select label="Country" name="country" autoComplete="country" placeholder="Choose a country" required>
      <option value="FI">Finland</option>
      <option value="SE">Sweden</option>
      <option value="NO">Norway</option>
    </Select>
    <Select label="Language" name="language" placeholder="Choose a language" required hideRequired>
      <option value="fi">Suomi</option>
      <option value="sv">Svenska</option>
      <option value="en">English</option>
    </Select>
  </Stack>
);

```

```html
<k-stack>
  <k-select>
    <label class="k-label" for="country">Country<span class="k-label-required" aria-hidden="true">*</span></label>
    <div class="k-field">
      <select id="country" name="country" autocomplete="country" required>
        <option value="">Choose a country</option>
        <option value="FI">Finland</option>
        <option value="SE">Sweden</option>
        <option value="NO">Norway</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select>
    <label class="k-label" for="language">Language</label>
    <div class="k-field">
      <select id="language" name="language" required>
        <option value="">Choose a language</option>
        <option value="fi">Suomi</option>
        <option value="sv">Svenska</option>
        <option value="en">English</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
</k-stack>
```

### Sizes

```tsx
import { Select, Stack } from "@kesko/components";

export default () => (
  <Stack>
    <Select label="Large" size="lg" placeholder="Placeholder">
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
    </Select>
    <Select label="Medium" placeholder="Placeholder">
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
    </Select>
  </Stack>
);

```

```html
<k-stack>
  <k-select size="lg">
    <label class="k-label" for="large">Large</label>
    <div class="k-field">
      <select id="large">
        <option value="">Placeholder</option>
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
  <k-select>
    <label class="k-label" for="medium">Medium</label>
    <div class="k-field">
      <select id="medium">
        <option value="">Placeholder</option>
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
      </select>
      <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
    </div>
  </k-select>
</k-stack>
```

### Validation

```tsx
import { Button, Select, Stack } from "@kesko/components";

export default () => (
  <form onSubmit={event => event.preventDefault()}>
    <Stack>
      <Select label="Country" name="country" placeholder="Choose a country" required>
        <option value="FI">Finland</option>
        <option value="SE">Sweden</option>
      </Select>
      <Select label="Delivery slot" name="slot" defaultValue="afternoon" error="That slot is no longer available.">
        <option value="morning">8–12</option>
        <option value="afternoon">12–16</option>
        <option value="evening">16–20</option>
      </Select>
      <Select label="Store" name="store" defaultValue="sello" success="This store has every item in stock.">
        <option value="sello">K-Citymarket Sello</option>
        <option value="kamppi">K-Supermarket Kamppi</option>
      </Select>
      <Button type="submit">Submit</Button>
    </Stack>
  </form>
);

```

```html
<form>
  <k-stack>
    <k-select>
      <label class="k-label" for="country">Country<span class="k-label-required" aria-hidden="true">*</span></label>
      <div class="k-field">
        <select id="country" name="country" required>
          <option value="">Choose a country</option>
          <option value="FI">Finland</option>
          <option value="SE">Sweden</option>
        </select>
        <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
      </div>
    </k-select>
    <k-select>
      <label class="k-label" for="slot">Delivery slot</label>
      <div class="k-field">
        <select id="slot" name="slot" aria-describedby="slot-message" aria-invalid="true">
          <option value="morning">8–12</option>
          <option value="afternoon" selected>12–16</option>
          <option value="evening">16–20</option>
        </select>
        <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
      </div>
      <k-field-message variant="error" role="alert"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M22.113 18.023L13.745 3.08c-.75-1.343-2.738-1.338-3.49 0L1.888 18.023C1.153 19.332 2.13 21 3.633 21h16.735c1.503 0 2.476-1.666 1.745-2.978zM20.367 19.5H3.633a.504.504 0 0 1-.435-.745l8.364-14.94a.506.506 0 0 1 .875 0l8.368 14.942a.501.501 0 0 1-.438.743zm-8.885-5.66l-.31-4.785c0-.115.08-.195.194-.195h1.265c.116 0 .196.08.196.195l-.3 4.613c0 .127-.058.217-.208.242l-.61.102c-.128.023-.217-.035-.23-.172zM13 16.14c0 .552-.403.978-1 .978s-1-.425-1-.978.403-.965 1-.965 1 .425 1 .965z" fill="currentColor" /></svg><span id="slot-message">That slot is no longer available.</span></k-field-message>
    </k-select>
    <k-select success>
      <label class="k-label" for="store">Store</label>
      <div class="k-field">
        <select id="store" name="store" aria-describedby="store-message">
          <option value="sello" selected>K-Citymarket Sello</option>
          <option value="kamppi">K-Supermarket Kamppi</option>
        </select>
        <svg slot="end" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.747 10.313l-6.465 6.464a.401.401 0 0 1-.565 0l-6.464-6.465a.401.401 0 0 1 0-.564l.495-.495a.401.401 0 0 1 .565 0L12 14.94l5.688-5.687a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565z" fill="currentColor" /></svg>
      </div>
      <k-field-message variant="success" role="status"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.182a.4.4 0 0 1 .055.563l-5.728 6.98a.748.748 0 0 1-.554.275h-.025a.745.745 0 0 1-.545-.235l-3.725-3.958a.397.397 0 0 1 .017-.564l.51-.48a.397.397 0 0 1 .565.017l3.14 3.338 5.185-6.32a.4.4 0 0 1 .563-.055l.54.445zm2.525-2.14a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg><span id="store-message">This store has every item in stock.</span></k-field-message>
    </k-select>
    <button class="k-button" type="submit">Submit</button>
  </k-stack>
</form>
```


## Props

- `label` — `ReactNode` Label for the select. Always provide one, even when it is hidden with `hideLabel`.
- `hideLabel` — `boolean` (default: `false`) Hides the label visually while keeping it available to assistive technology.
- `description` — `ReactNode` Assistive text shown below the control, such as what the choice affects.
- `error` — `ReactNode` Optional error message for the select, shown instead of the built-in validation message. Also marks the control invalid for assistive technology.
- `success` — `ReactNode` Optional success message for the select. Shown only while there is no error. A plain string is also announced to screen readers when it appears.
- `size` — `"md" | "lg"` (default: `"md"`) The size of the select.
- `name` — `string` The name the value is submitted under.
- `value` — `string` The value of the selected option. Pair with `onChange` to control the field.
- `defaultValue` — `string` The value of the option selected at first in an uncontrolled field.
- `form` — `string` The `id` of the form the control submits with. Only needed when the control sits outside that form.
- `placeholder` — `string` Text shown while nothing is chosen. Renders an option with an empty value first, so a `required` select stays invalid until a real option is picked. Not a substitute for a label.
- `required` — `boolean` (default: `false`) Requires a choice before the form submits. Draws the marker on the label and is announced to assistive technology.
- `hideRequired` — `boolean` (default: `false`) Hides the required marker on the label while keeping `required` on the control. Use it when the form says once that every field is required.
- `disabled` — `boolean` Disables the control. Blocks interaction and drops the value from the submitted data.
- `autoComplete` — `string` Tells the browser what the value is for, so it can offer to fill it in, such as `country` or `bday-month`.

## Events

- `onChange` — `(event: ChangeEvent<HTMLSelectElement>) => void` Handler called when a different option is chosen.
- `onFocus` — `(event: FocusEvent<HTMLSelectElement>) => void` Handler called when the control receives focus.
- `onBlur` — `(event: FocusEvent<HTMLSelectElement>) => void` Handler called when the control loses focus.

## CSS custom properties

- `--k-select-bg` (default: `var(--k-color-bg-base)`) Overrides the background color.
- `--k-select-text` (default: `var(--k-color-text-base)`) Overrides the text color.
- `--k-select-border` (default: `var(--k-color-border-control)`) Overrides the border color in every state.
- `--k-select-radius` (default: `var(--k-radius-md)`) Overrides the border radius.
- `--k-select-inline-size` (default: `100%`) Overrides the width of the field.

## Accessibility

Select is built on a native `<select>` and `<label>`, so it opens the browser’s own picker on every device and behaves as expected with assistive technologies.

- **Always pass a `label`.** A screen reader reads it as the name, and clicking it focuses the control. If there is no room for it, pass `hideLabel` rather than leaving it out.
- **Start from a real choice or a `placeholder`.** Without either, the first option is selected and submitted silently. `placeholder` adds an empty option, so a `required` select stays invalid until a real option is picked. Don’t hide instructions in a preselected option.
- **Keep option text short and self-contained.** The picker shows the text alone, without the label. Use `optgroup` to group a long list rather than repeating a prefix on every option.
- **The `start` slot is decorative.** An icon in `slot="start"` is not read as part of the control’s name and should carry `aria-hidden`.
- **Avoid `disabled` for validation.** A disabled control leaves the tab order and cannot explain itself. Keep it enabled and let the message say what is wrong. Disable single options that cannot be chosen right now, and say why in the option text.
- **Check contrast if you override colors.** Text needs 4.5:1 against `--k-select-bg`, and `--k-select-border` needs 3:1 against the surface the field sits on. Verify with the [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/).

See the [accessibility guidelines](/accessibility/) and the [A11Y checklist](/a11y-checklist/) for more details.

## Integration

Install `@kesko/components` together with `@kesko/css`, which provides the design tokens and base styles it depends on, and `@kesko/themes` for your brand:

```sh
npm install @kesko/components @kesko/css @kesko/themes
```

Then load the base stylesheet and one brand theme once, in your app's entry point or root layout. Leave out `@kesko/css/components`: it mirrors the component styles for plain HTML, and `@kesko/components` already ships them.

```tsx
import "@kesko/css";
import "@kesko/themes/dist/k-rauta.css";
```

Finally, import the component into your project:

```tsx
import { Select } from "@kesko/components";
```

Projects without React get the same markup and styling from `@kesko/css` by importing the base stylesheet, the `components` add-on and a brand theme, in that order:

```css
@import "@kesko/css";
@import "@kesko/css/components";
@import "@kesko/themes/dist/k-rauta.css";
```

The HTML examples above show the exact markup to copy.

## Resources

- [Usage guidelines](/components/usage/) — Learn how to use the component library with React, Next.js, or basic HTML.
- [Localization](/localization/) — How to translate the components for multiple languages.
- [CSS Framework](/css/) — Utilities and tokens for everything the components don’t cover.
- [Themes](/themes/) — How to customize the component library theme.
- [Accessibility checklist](/a11y-checklist/) — Interactive, browser-based Kesko accessibility checklist.

