CSC Design System next
VueFlavour Vue React Angular TypeScript PrimaryCSC UI ColorsPrimarySecondaryAccentCustom ColorsRedOrangeGreenBluePurplePink
Guides Getting started Customization Data visualization Migration guide Componentsc-accordionc-alertc-autocompletec-badgec-buttonc-button-groupc-cardc-checkboxc-csc-logoc-data-tablec-dividerc-iconc-icon-buttonc-inputc-linkc-listc-loaderc-login-buttonsc-login-cardc-mainc-menuc-messagec-modalc-navigation-buttonc-otp-inputc-pagec-paginationc-popoverc-progress-barc-progress-circlec-radio-groupc-selectc-side-navigationc-sliderc-spinnerc-statusc-stepsc-switchc-tablec-tabsc-tagsc-text-fieldc-toastsc-toolbarc-tooltip

<c-select>

Examples

Basic
Vue React Angular TypeScript
<template>
  <div>
    <c-select
      v-model="country"
      clearable
      hint="The list opens on click or with the arrow keys"
      label="Country"
      placeholder="Choose a country"
    >
      <c-option name="Finland" value="fi">Finland</c-option>

      <c-option name="Sweden" value="se">Sweden</c-option>

      <c-option name="Norway" value="no">Norway</c-option>

      <c-option name="Denmark" value="dk">Denmark</c-option>
    </c-select>

    <p>Value: {{ country ?? 'null' }}</p>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const country = ref<string | null>(null);
</script>
Small
Vue React Angular TypeScript
<template>
  <div>
    <c-select v-model="country" label="Country" size="small">
      <c-option name="Finland" value="fi">Finland</c-option>

      <c-option name="Sweden" value="se">Sweden</c-option>

      <c-option name="Norway" value="no">Norway</c-option>
    </c-select>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const country = ref<string | null>('fi');
</script>
Basic · c-option
Vue React Angular TypeScript
<template>
  <div>
    <c-select
      v-model="country"
      clearable
      hint="Each c-option provides a name and a value"
      label="Country"
      placeholder="Choose a country"
    >
      <c-option name="Finland" value="fi">Finland</c-option>

      <c-option name="Sweden" value="se">Sweden</c-option>

      <c-option name="Norway" value="no">Norway</c-option>

      <c-option name="Denmark" value="dk" disabled>Denmark</c-option>
    </c-select>

    <p>Value: {{ country ?? 'null' }}</p>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const country = ref<string | null>(null);
</script>

API reference

<c-select>

Properties

PropertyAttributeTypeDefaultDescription
clearableclearablebooleanfalseMake the selected value clearable
disableddisabledbooleanfalseDisable the input
errorMessageerror-messagestring''Error message shown in place of the hint while the select is invalid
hideDetailshide-detailsbooleanfalseHide the hint and error messages
hinthintstring''Hint text for the input
hostIdhost-idstring''Id of the element
itemsCSelectItem[]() => []Dropdown items (when not using <c-option> elements)
itemsPerPageitems-per-pagenumber6Items per page before adding scroll
labellabelstring''Element label
labelOnToplabel-on-topbooleanfalseLabel on top of the input
loadingloadingbooleanfalseShow loading state
namenamestring''Input field name
optionAsSelectionoption-as-selectionbooleanfalseDisplay the option as selection (only with <c-option> elements)
placeholderplaceholderstring''Placeholder text
requiredrequiredbooleanfalseSet the select as required
returnObjectreturn-objectbooleanfalseReturn object instead of value
shadowshadowbooleanfalseShadow variant
sizesizeCFieldSize'default'Field height: the 44px default or the 36px `small` box
validvalidbooleantrueSet the validity of the input
valuevalueCSelectItem | null | number | stringnullSelected value (scalar, or object when return-object is set)

Events

EventDetailDescription
changeValueCSelectItem | null | number | stringFired when the selection changes (an option is picked or the value is cleared), carrying the new value — the option's value, or the whole `{ name, value }` item when `return-object` is set; `null` when cleared. Also dispatched as `change-value` — bind that name in Vue templates.
inputvoidNative bubbling input event dispatched alongside every value change so a plain `v-model` stays in sync. Carries no detail.
update:valueCSelectItem | null | number | stringFired alongside `changeValue` with the same detail — the `v-model` contract.

Methods

MethodSignatureDescription
reset()Reset select state

Slots

SlotDescription
defaultUse c-option elements only
preLeading content forwarded to the inner c-input, rendered before the select's value
postTrailing content forwarded to the inner c-input, rendered after the select's controls

CSS parts

Style from outside with c-select::part(name) — parts are the library's only styling customization API.

PartDescription
menuThe dropdown surface (the positioned dialog) holding the field and the list
listThe scrolling listbox of options
itemOne option row in the list. Any `part` attribute set on content inside a slotted `<c-option>` is exported too, so `c-select::part(<name>)` reaches the consumer's own option markup

Types

Importable from the package root: import type { … } from '@cscfi/csc-ui'

CFieldSize shared

Field height of the form controls built on `c-input`. `default` is the 44px field; `small` is the 36px field. Owned here because the value passes from the wrapping control (`c-select`) into `c-input`.

export type CFieldSize = 'default' | 'small';
CSelectItem shared

A selectable item for the value-selection components (`c-select`, `c-autocomplete`) when options are supplied via the `items` prop instead of slotted `<c-option>` elements.

export interface CSelectItem {
  /** Disable the item so it cannot be selected. */
  disabled?: boolean;
  /** The item's display label. */
  name: string;
  /** The value emitted via v-model when the item is selected. */
  value: number | string;
}

<c-option>

Properties

PropertyAttributeTypeDefaultDescription
disableddisabledbooleanfalseSet option as disabled
namenamestringOption name (display label fallback)
selectedselectedbooleanfalseSet option as selected
valuevaluenumber | stringOption value

Slots

SlotDescription
defaultThe option's visible label content, shown in the c-select dropdown list