Skip to main content

Your opinion matters! Together with you, we want to continuously improve KoliBri. Share your ideas, wishes, or suggestions—quickly and easily.

SingleSelect

This documentation is currently being revised and is in beta status. Content may still change.
This component is being retested for accessibility. The full test is still pending and can only be completed after a release.

Synonyms: Dropdown, Selection field, Simple selection

Description: The SingleSelect component creates a selection box that allows users to select exactly one predefined option from a list. The input field combines the functionality of a text field with a dropdown list and optionally offers a search function to filter the available options.

Example

Rendering of the component with the essential properties. Code can be displayed.

<KolSingleSelect _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} _placeholder="Please select an option" />

Accessibility

The SingleSelect component was developed with a focus on accessibility:

  • Label requirement: Every instance must have a unique description via the _label attribute. This ensures that screen reader users understand what selection they are making.
  • Hint texts: With _hint, additional information can be provided that is read aloud by screen readers.
  • Error messages: With _msg, error messages can be output that are automatically linked to the input field.
  • Keyboard navigation: The component is fully operable via keyboard with intuitive navigation through the options list.
  • Status display: The selected state is correctly communicated to assistive technologies.
  • Required fields: Fields marked with _required are signalled to assistive technologies.

Usage

Keyboard Control

KeyFunction
TabFocuses the SingleSelect field or moves to the next element.
Shift + TabMoves to the previous interactive element.
Space / EnterOpens the dropdown list or selects the focused option.
Arrow upNavigates to the previous option in the list.
Arrow downNavigates to the next option in the list.
HomeJumps to the first option in the list.
EndJumps to the last option in the list.
EscapeCloses the dropdown list without saving.
CharacterFilters the options by input (when search function is enabled).

Best Practices / Recommendations

  • Meaningful labels: Use clear, understandable descriptions that make the purpose of the selection obvious.
  • Sensible options: Do not make the options list too long; use grouping or pagination if needed.
  • Use placeholder wisely: The placeholder should only serve as supplementary help, not as an instruction.
  • Check default value: Consider whether a reasonable default value should be set to minimise user errors.
  • Concrete error messages: Provide meaningful validation error messages via _msg.
  • Clear grouping: For many options (more than 15), consider a different component such as a table or Combobox.
  • Clear button: If needed, set an explicit submit button to give users confidence.

Use Cases

  • Selection of title, salutation or gender in forms
  • Selection of a country or region
  • Selection of a category or status
  • Filtering by a single criterion
  • Selection of a date or time from predefined values
  • Single selection in settings or configurations

Construction / Technology

Playground

Test the various properties of the SingleSelect component:

Icons
Message
<KolSingleSelect _label="Salutation" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

Functionality (with Code)

Simple Selection

Standard selection with label and options list:

<KolSingleSelect _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

Placeholder

A placeholder text is displayed when no option has been selected yet:

<KolSingleSelect _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} _placeholder="Please select an option" />

Form Attributes

Standard attributes for forms:

Message
<KolSingleSelect _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

Available attributes:

  • _required: Marks the field as required
  • _disabled: Disables the input field
  • _hideLabel: Hides the label visually (remains visible to assistive technologies)
  • _msg: Error messages or validation hints
  • _hideMsg: Hides the error message visually but keeps it in the DOM for aria-describedby

Clear Button

The clear button allows the current selection to be deleted:

<KolSingleSelect _hasClearButton={true} _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

Icons

Icons can be displayed to the left and right of the input field:

Icons
<KolSingleSelect _icons="fa-solid fa-location-dot" _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

Hint Text and Error Message

Hint texts can be provided before input, error messages after invalid selection:

Message
<KolSingleSelect _hint="Additional hints for the selection" _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} />

The maximum number of visible options is controlled via _rows:

<KolSingleSelect _label="Select" _options={[{"label":"Herr","value":"Herr"},{"label":"Frau","value":"Frau"},{"label":"Firma","value":"Firma"}]} _rows={3} />

Events

For the handling of events or callbacks, see .

EventTriggerValue
clickInput field is clicked-
focusInput field is focused-
blurInput field loses focus-
inputOption is selectedvalue attribute of option
changeOption is selectedvalue attribute of option

API

Overview

The SingleSelect component creates a dropdown list from which exactly one predefined option can be selected.

Properties

PropertyAttributeDescriptionTypeDefault
_accessKey_access-keyDefines the key combination that can be used to trigger or focus the component's interactive element.string | undefinedundefined
_disabled_disabledMakes the element not focusable and ignore all events.boolean | undefinedfalse
_hasClearButton_has-clear-buttonShows the clear button if enabled.boolean | undefinedtrue
_hideLabel_hide-labelHides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it.boolean | undefinedfalse
_hideMsg_hide-msgHides the error message but leaves it in the DOM for the input's aria-describedby.boolean | undefinedfalse
_hint_hintDefines the hint text.string | undefined''
_icons_iconsDefines the icon classnames (e.g. icons="fa-solid fa-user").string | undefined | { right?: IconOrIconClass | undefined; left?: IconOrIconClass | undefined; }undefined
_label (required)_labelDefines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to false to enable the expert slot.stringundefined
_msg_msgDefines the properties for a message rendered as Alert component.Omit<AlertProps, "_on" | "_variant" | "_hasCloser" | "_label" | "_level"> & { _description: string; } | string | undefinedundefined
_name_nameDefines the technical name of an input field.string | undefinedundefined
_on--Gibt die EventCallback-Funktionen für das Input-Event an.InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus & InputTypeOnInput & InputTypeOnKeyDown | undefinedundefined
_options (required)_optionsOptions the user can choose from.Option<StencilUnknown>[] | stringundefined
_placeholder_placeholderDefines the placeholder for input field. To be shown when there's no value.string | undefinedundefined
_required_requiredMakes the input element required.boolean | undefinedfalse
_rows_rowsMaximum number of visible rows of the element.number | undefinedundefined
_shortKey_short-keyAdds a visual shortcut hint after the label and instructs the screen reader to read the shortcut aloud.string | undefinedundefined
_tooltipAlign_tooltip-alignDefines where to show the Tooltip preferably: top, right, bottom or left."bottom" | "left" | "right" | "top" | undefined'top'
_touched_touchedShows if the input was touched by a user.boolean | undefinedfalse
_value_valueDefines the value of the element.boolean | null | number | object | string | undefinednull

Methods

focus

focus() => Promise<void>

Sets focus on the internal element.

Returns

Type: Promise<void>

getValue() => Promise<StencilUnknown>

Returns the current value.

Returns

Type: Promise<StencilUnknown>

Slots

SlotDescription
The label of the input field.