Skip to content

Select

Select inputs are fields that allow users to choose options from a menu.

Usage

Element offers two distinct select input types: the Default Select and the Advanced Select.

The default select is based on the native HTML select element. Use it for straightforward scenarios where users need to select a single option from a dropdown list.

The advanced select is designed to accommodate more complex requirements, offering support for single-selection, multi-selection, icons, and a search function. This variant should be employed only when one or more of the mentioned capabilities are necessary.

Select input field

When to use

  • When users need to make a choice among a list of options.
  • When there are more than 5 options to choose from.
  • When options can be logically grouped (e.g., countries, cities, etc.).
  • Use it in forms and for attribute selection.

Best practices

  • Don't use it if there are less than three options available for selection.
  • Analyze what actions will save more time for the user (e.g. selecting an item versus typing that item).
  • If possible, mark the default option as the recommended one (avoid extra clicking).

Design

Default select

Select input

1.Label (optional), 2. Content/placeholder text, 3. Container, 4. Arrow

Advanced select

Select input advanced

Label (optional) 2. Content/placeholder text, 3. Container, 4. Arrow, 5. Icon (optional), 6. Menu

Advanced select supports both single and multiple selections. When dealing with many options, a filterable menu with a search bar can be used to streamline selection.

Select input advanced menu

Selected options are displayed within the input field. If they exceed the available space, they will be grouped into a single pill (e.g. using 3+).

Select input advanced responsive

States

Advanced select provides two configurations: Inline for direct integration with content, and form-style for structured data entry.

Select input states

Label (optional)

Effective form labeling helps users understand what information to enter.

  • Keep labels short and clear (should not be wider than the input field).
  • A mandatory field is marked with an *-asterisk.

Select input label

Validation

The select input field has the same validation states as a input component.

Code

References

Example

si-select component

Element also offers a custom select component called si-select. The si-select component provide the following abilities:

  • specify the icon for each specified option.
  • disable options
  • single / multi-select behavior
  • custom option input
  • option groups
  • customizable rendering of options
  • option filtering
  • customizable footer with actions

The component should only be used if you require one of the listed abilities. Otherwise the native select input with Bootstrap markup is preferred.

Usage

si-select can be imported using the module

import { SiSelectModule } from '@siemens/element-ng/select';

@NgModule({
  imports: [SiSelectModule, ...]
})

or as a standalone component:

import {
  SiSelectComponent,
  SiSelectSimpleOptionsDirective, // At least one option directive is required. Unused option types can be omitted.
  SiSelectSingleValueDirective, // At least one value directive is required. Unused value types can be omitted.
  SiSelectMultiValueDirective
} from '@siemens/element-ng/select';

@Component({
  imports: [
    SiSelectComponent,
    SiSelectSimpleOptionsDirective,
    SiSelectSingleValueDirective,
    SiSelectMultiValueDirective,
  ]
})

Options

Options are provided as an array of SelectItem<T> objects:

<si-select
  [options]="[
    {
      type: 'option',
      value: { id: id, myProperty: myValue },
      label: 'Label',
      disabled: false,
      icon: 'element-face-happy',
      iconColor: 'status-success'
    }
  ]"
/>

Customize option rendering using a template. This template is used for options in the dropdown and, when no input template is provided, for the selected value in the closed input as well:

<si-select
  [options]="[
    { type: 'option', value: 'good', label: 'Good' },
    { type: 'option', value: 'fair', label: 'Fair' },
    { type: 'option', value: 'bad', label: 'Bad' }
  ]"
>
  <ng-template let-option siSelectOptionTemplate>{{ option.label | uppercase }}</ng-template>
</si-select>

To use different templates for the dropdown options and the selected value in the closed input, provide an additional siSelectValueTemplate template. Both templates receive the SelectOption<T> as their implicit value:

<si-select [options]="options">
  <ng-template let-option siSelectOptionTemplate>
    <div class="d-flex flex-column">
      <span>{{ option.label }}</span>
      <small class="text-secondary">Additional information</small>
    </div>
  </ng-template>
  <ng-template let-option siSelectValueTemplate>{{ option.label }}</ng-template>
</si-select>

Wrap options in groups:

<si-select
  [options]="[
    {
      type: 'group',
      label: 'Group',
      options: [{ type: 'option', label: 'Option', value: 'value' }]
    }
  ]"
>
  <!-- Optional group template -->
  <ng-template let-group siSelectGroupTemplate>{{ group.label | uppercase }}</ng-template>
</si-select>

Lazy options

Instead of providing eagerly loaded options, applications can provide an [optionSource]. The option source allows lazy loading of options. It can be used with or without filtering.

To use the [optionSource] applications must implement the SelectOptionSource interface:

// This provides options which value are of type MyValue.
// For async methods the si-select will show a loading spinner until the observable emits the first time.
// Always return options in a consistent order.
export class MyOptionSource implements SelectOptionSource<MyValue> {
  getOptionsForValues(values: MyValue[]): Observable<SelectOptionNext<MyValue>[]> {
    // si-select will call this function when it needs to get options for the provided values.
    // This function is typically called when the value is set via a formControl or ngModel.
    // Lookup the values on your server and return the corresponding options.
  }

  getAllOptions?(): Observable<SelectItem<MyValue>[]> {
    // This function is optional, if filtering is enabled.
    // The options returned by this function are shown in the dropdown when no search value is provided.
    // You can return all available options or just a subset of the most common options.
    // If this function is not implemented only the selected options are shown.
  }

  getOptionsForSearch?(search: MyValue): Observable<SelectItem<MyValue>[]> {
    // This function is required if filtering is enabled.
    // It is never called with an empty search value.
    // Return all options that matches the search value.
  }

  compareOptions?(a: SelectOptionNext<MyValue>, b: SelectOptionNext<MyValue>): number {
    // This function is optional.
    // If provided it is used to compare options for sorting.
    // This ensures a correct order if options are loaded from the cache.
  }

  optionsEqual?(optionA: MyValue, optionB: MyValue): boolean {
    // By default si-select checks values on equality by reference.
    // If you use objects as values override this method so that equal values are recognized as such.
    // For primitiv values like strings this method should be omitted.
  }
}

Then use this source in your component:

import {
  SiSelectComponent,
  SiSelectSingleValueDirective,
  SiSelectLazyOptionsDirective
} from '@siemens/element-ng/select';

@Component({
  selector: 'app-sample',
  template: '<si-select [optionSource]="myOptionSource" [formControl]="control" />',
  imports: [SiSelectComponent, SiSelectSingleValueDirective, SiSelectLazyOptionsDirective]
})
export class SampleComponent {
  myOptionSource = new MyOptionSource();
  control = new FormControl<MyValue | null>(null);
}

Selection

Single selection:

@Component({
  selector: 'app-sample',
  imports: [SiSelectComponent, SiSelectSimpleOptionsDirective, SiSelectSingleValueDirective],
  template: '<si-select [options]="optionsList" [(value)]="selected" />'
})
export class SampleComponent {
  optionsList: SelectItem<string>[] = [
    {
      type: 'option',
      value: 'good',
      label: 'Good'
    },
    {
      type: 'option',
      value: 'fair',
      label: 'Fair'
    }
  ];
  selected = 'good';
}

Multi selection:

@Component({
  selector: 'app-sample',
  imports: [SiSelectComponent, SiSelectSimpleOptionsDirective, SiSelectMultiValueDirective],
  template: '<si-select multi [options]="optionsList" [(value)]="multiValue" />'
})
export class SampleComponent {
  optionsList: SelectItem<string>[] = [
    { type: 'option', value: 'good', label: 'Good' },
    { type: 'option', value: 'fair', label: 'Fair' }
  ];
  multiValue = ['good', 'fair'];
}

Filtering options

Add the attribute hasFilter to enable an input element for option filtering in the overlay of the si-select component. If a custom template is used, a value provider is required.

<si-select hasFilter [options]="[...]" />

By using the siSelectActions directive, you can add custom actions to the footer of the si-select component.

To align the styling to the design system specification it is necessary that actions:

  • apply the siSelectAction directive to each item
  • and footer buttons shall apply the following classes btn btn-link.
<si-select [options]="[{ id: 'option1', title: 'Option 1' }, { id: 'option2', title: 'Option 2' }]">
  <ng-template siSelectActions>
    <button siSelectAction type="button" class="btn btn-link" aria-label="Action 1">
      Action 1
    </button>
    <button siSelectAction type="button" class="btn btn-link" aria-label="Action 2">
      Action 2
    </button>
  </ng-template>
</si-select>

In some scenarios it is necessary to close the dropdown on click for example to display a modal dialog. The siSelectActions directive offers an input selectActionAutoClose for this purpose.

The following demonstrates how to add a "Create" button within the dropdown actions that, when clicked, will close the dropdown:

<si-select [options]="[{ id: 'option1', title: 'Option 1' }, { id: 'option2', title: 'Option 2' }]">
  <ng-template siSelectActions>
    <button siSelectAction selectActionAutoClose type="button" class="btn btn-link" (click)="....">
      Create
    </button>
  </ng-template>
</si-select>

Custom select (experimental)

When the rigid si-select options API is not enough — for example to embed a tree, drive multi-stage selection with Apply / Cancel semantics, or render arbitrary UI inside the dropdown — applications can compose their own select from the following primitives:

  • SiCustomSelectDirective — host directive providing the combobox wiring: ControlValueAccessor (formControl, ngModel, [(value)]), disabled / readonly handling, SiFormItemControl integration, ARIA combobox role, keyboard activation (Enter, Space, ArrowDown / ArrowUp), CDK overlay lifecycle, and focus trapping inside the dropdown.
  • SiSelectComboboxComponent — the visual trigger that renders the projected value and the dropdown caret. Pair it with SiSelectComboboxValueComponent to mark individual selected entries.
  • SiSelectDropdownDirective — structural directive (*si-select-dropdown / <ng-template si-select-dropdown>) that registers the dropdown content template with the parent custom select. Requires a contentType input whose value is forwarded to the aria-haspopup attribute of the combobox host (menu, listbox, tree, grid, dialog, true, or false).

The strategy is intentionally minimal: the host directive owns state, focus, keyboard handling and form integration, while applications retain full control over what is rendered in the trigger and in the dropdown. The same component can therefore be styled either as a form-control (inside an si-form-item, with validation) or as a button (btn btn-ghost) by applying the corresponding class on the host element.

A custom select component typically applies SiCustomSelectDirective as a host directive and exposes the inputs and outputs the application needs:

@Component({
  selector: 'app-tree-select',
  imports: [SiSelectComboboxComponent, SiSelectDropdownDirective, SiTreeViewComponent],
  template: `
    <si-select-combobox>
      @if (select.value(); as val) {
        {{ val }}
      } @else {
        <span class="text-secondary">Select a location...</span>
      }
    </si-select-combobox>

    <ng-template si-select-dropdown contentType="tree">
      <si-tree-view
        ariaLabel="Locations"
        [items]="items()"
        [enableSelection]="true"
        [singleSelectMode]="true"
        (treeItemClicked)="selectItem($event)"
      />
    </ng-template>
  `,
  hostDirectives: [
    {
      directive: SiCustomSelectDirective,
      inputs: ['disabled', 'readonly', 'value'],
      outputs: ['valueChange']
    }
  ]
})
export class TreeSelectComponent {
  protected readonly select = inject<SiCustomSelectDirective<string>>(SiCustomSelectDirective);

  readonly items = input<TreeItem[]>([]);

  selectItem(item: TreeItem): void {
    if (item.label) {
      this.select.updateValue(item.label as string);
      this.select.close();
    }
  }
}

Because si-tree-view (and similar components) mutate the model they render, inputs must be deep-cloned before they are passed in. A robust pattern is to keep a pendingItems signal that is repopulated from a fresh JSON.parse(JSON.stringify(...)) clone whenever the dropdown opens, so each opening starts from a clean slate without leaking state back to the caller.

The same primitives can drive a multi-select with Apply / Cancel. The host component buffers pending changes while the dropdown is open and only calls select.updateValue(...) once the user confirms — keeping the ControlValueAccessor value stable until the selection is applied.

SiSelectComponent API Documentation

selector
si-select

Common interface for form item controls. Controls that should be connected to SiFormItemComponent must implement this interface and must be provided using the SI_FORM_ITEM_CONTROL token.

Input Properties

Name Type Default Description
ariaLabel
(string | null) null Aria label of the select.
disabled
boolean false Whether the select input is disabled.
errormessageId
string ${this.id()}-errormessage This ID will be bound to the aria-describedby attribute of the select.
filterPlaceholder
TranslatableString $localize`:@@SI_SELECT.SEARCH-PLACEHOLDER:Search…` Placeholder for search input field.
hasFilter
boolean false Enables the filter input
id
string __si-select-${SiCustomSelectDirective.idCounter++} Unique identifier.
labelledby
string undefined Aria labelledby of the select.
noResultsFoundLabel
TranslatableString $localize`:@@SI_SELECT.NO-RESULTS-FOUND:No results found` Label if no item can be found.
placeholder
TranslatableString Placeholder text to display when no options are selected.
readonly
boolean false Readonly state. Similar to disabled but with higher contrast.
scrollStrategy
ScrollStrategy defaultConnectedOverlayScrollStrategy() Optional CDK scroll strategy used for the custom select overlay.

Output Properties

Name Type Description
openChange
boolean Emits when the dropdown open state changes.

Attributes and Methods

Name Type Default Description
close()
() => void Closes the si-select .
(readonly) errormessageId
InputSignal<string> ... ID bound to the select's aria-describedby attribute.
(readonly) id
InputSignal<string> ... Unique identifier.
(readonly) labelledbyInput
InputSignal<(string | undefined)> ... Aria labelledby of the select.
open()
() => void Opens the si-select .
(readonly) openChange
OutputEmitterRef<boolean> ... Emits when the dropdown open state changes.
(readonly) readonly
InputSignalWithTransform<boolean, unknown> ... Readonly state.
(readonly) scrollStrategy
InputSignal<ScrollStrategy> ... Scroll strategy used for the select overlay.

Simple options (via SiSelectSimpleOptionsDirective)

selector
si-select[options]

This directive allows passing SelectItem to the SiSelectComponent .

Example:

<si-select [options]="[{ type: 'option', value: 'one', label: 'One' }, { type: 'option', value: 'two', label: 'Two' }]"></si-select>
<si-select [options]="[{ type: 'group', label: 'Group', options [{ type: 'option', value: 1, label: 'One' }, { type: 'option', value: 2, label: 'Two' }] }]"></si-select>

Input Properties

Name Type Default Description
optionEqualCheckFn
(a: T, b: T) => boolean (a: T, b: T): boolean =​> a === b By default, values are check on referential equality. Provide a function to customize the behavior.
options
(SelectItem<T>[] | null) Options to be shown in select dropdown

Attributes and Methods

Name Type Default Description
(readonly) allRows
Signal<SelectItem<T>[]> [] All group and option items in the dropdown.
onFilter(...)
(filterValue: string) => void This function is called when a user enters a filter query. It is expected that an implementation will update the rows based on the query.

Parameters
onValueChange(...)
(value: T[]) => void Is always called when the value changes. The implementation must update selectedRows when called.

Parameters
  • value: T[]  currently selected value of the related si-select.
(readonly) rows
Signal<SelectItem<T>[]> [] Rows that should be shown.
(readonly) selectedRows
Signal<SelectOption<T>[]> ... List of all options that are currently selected. Must be updated when onValueChange is called.

SiCustomSelectDirective API Documentation

selector
[siCustomSelect]

Host directive for building custom selects.

Add this as a hostDirective on your component and expose the inputs/outputs you need. The directive handles: - ControlValueAccessor: ControlValueAccessor integration ( formControl , ngModel , [(value)] ) - Disabled / readonly state management - Overlay lifecycle for the dropdown (open/close) - Focus management and focus trapping in the dropdown - Opening the dropdown on click, Enter, Space, ArrowDown, ArrowUp - SiFormItemControl integration

Use SiSelectDropdownDirective to mark the dropdown template in your component, and call open , close , updateValue from your component logic.

Example:

@Component({
  selector: 'app-my-select',
  hostDirectives: [{
    directive: SiCustomSelectDirective,
    inputs: ['disabled', 'readonly', 'value'],
    outputs: ['valueChange']
  }],
  template: `
    <si-select-combobox>
      {{ select.value() }}
    </si-select-combobox>
    <ng-template si-select-dropdown contentType="listbox">
      <button (click)="select.updateValue('new'); select.close()">Pick</button>
    </ng-template>
  `
})
export class MySelectComponent {
  readonly select = inject(SiCustomSelectDirective);
}

Input Properties

Name Type Default Description
disabled
boolean false Whether the select input is disabled.
errormessageId
string ${this.id()}-errormessage This ID will be bound to the aria-describedby attribute of the select.
id
string __si-select-${SiCustomSelectDirective.idCounter++} Unique identifier.
labelledby
string undefined Aria labelledby of the select.
readonly
boolean false Readonly state. Similar to disabled but with higher contrast.
siCustomSelectScrollStrategy
ScrollStrategy defaultConnectedOverlayScrollStrategy() Optional CDK scroll strategy used for the custom select overlay.
value
(T | null) undefined The current value, supports two-way binding via [(value)] .

Output Properties

Name Type Description
openChange
boolean Emits when the dropdown open state changes.
valueChange
(T | null) The current value, supports two-way binding via [(value)] .

Attributes and Methods

Name Type Default Description
close()
() => void Closes the dropdown overlay and restores focus.
(readonly) disabled
Signal<boolean> ... Combined disabled state from input and form control.
(readonly) isOpen
WritableSignal<boolean> false Whether the dropdown is currently open.
open(...)
(event: Event) => void Opens the dropdown overlay.

Parameters
updateValue(...)
(value: (T | null | undefined)) => void Updates the value programmatically. Call this from your dropdown template to set the new value.

Parameters

SiSelectComboboxComponent API Documentation

selector
si-select-combobox

Visual trigger element for custom selects built with SiCustomSelectDirective . Renders the projected content and a dropdown caret icon.

The ARIA role, focus handling, and state attributes live on the host component via SiCustomSelectDirective — this component is purely visual.

Example:

<si-select-combobox>
  {{ select.value() }}
</si-select-combobox>

No API to document for this.

SiSelectComboboxValueComponent API Documentation

selector
si-select-combobox-value

Represents a single selected value inside an SiSelectComboboxComponent .

Project one <​si-select-combobox-value​> per selected entry. Optional icon , iconColor , stackedIcon and stackedIconColor inputs mirror the icon API of SelectOption and render an icon (with optional stacked overlay) before the projected content.

Add the comma-separated CSS class to render a comma between adjacent values. Omit it when using chips, custom separators, or a single value.

Example:

<si-select-combobox>
  <si-select-combobox-value
    icon="element-face-happy"
    iconColor="status-success"
  >
    {{ select.value() }}
  </si-select-combobox-value>
</si-select-combobox>

Input Properties

Name Type Default Description
icon
string An optional icon rendered before the projected content.
iconColor
string Optional CSS color class applied to icon .
stackedIcon
string Optional secondary icon stacked on top of icon .
stackedIconColor
string Optional CSS color class applied to stackedIcon .

SiSelectDropdownDirective API Documentation

selector
[si-select-dropdown]

Structural directive marking the dropdown template for custom selects built with SiCustomSelectDirective .

When placed on an <​ng-template​> , it automatically registers the template with the parent SiCustomSelectDirective .

Example:

<ng-template si-select-dropdown contentType="listbox">
  <!-- custom dropdown content -->
</ng-template>

Input Properties

Name Type Default Description
closeOnTab
boolean false Whether pressing Tab closes the dropdown.

Keep this disabled when the dropdown contains controls that users must reach with Tab.
contentType
Required
SiSelectDropdownContentType Describes the kind of content rendered by the dropdown. The value is forwarded to the aria-haspopup attribute of the combobox host of the parent SiCustomSelectDirective .

Types Documentation

Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality.
Common interface for form item controls. Controls that should be connected to SiFormItemComponent must implement this interface and must be provided using the SI_FORM_ITEM_CONTROL token.
Properties
Generated ID that the SiFormItemComponent will assign to the element containing the error messages. Implementations of SiFormItemControl must generate this ID and assign it to the aria-describedby attribute of their focusable elements.
errormessageId: (string | Signal<string>)
The actual id of the control that should be used in the for attribute of a label.
id?: (string | Signal<(string | undefined)>)
If the control is meant to be used a checkbox. This affects the label positioning.
isFormCheck?: boolean
ID that should be assigned to the label element inside the SiFormItemComponent .

If the target control is not of type input, select or button, it cannot be referenced by a label. Instead, aria-labelledby must be used to create a reference to a label. In such a case, an implementation of SiFormItemControl must provide the id of the label in labelledby . SiFormItemComponent will apply the id to the label so that it can be used inside the control to reference it in the aria-labelledby attribute.

labelledby?: (string | Signal<(string | undefined)> | null)
Properties
key: string
message?: TranslatableString
params: any
Interface for form error mapper. It resolves a key to either a translatable string or function which is called with the validation error for its key and should return a translatable string.
Index signature: [ key: string ]: (string | (error: any) => string | undefined)
Properties
dateFormat?: (TranslatableString | (error: { format: string }) => TranslatableString)
email?: (TranslatableString | (error: { email: boolean }) => TranslatableString)
max?: (TranslatableString | (error: { actual: number, max: number }) => TranslatableString)
maxDate?: (TranslatableString | (error: { actual: Date, max: Date }) => TranslatableString)
maxLength?: (TranslatableString | (error: { actualLength: number, requiredLength: number }) => TranslatableString)
min?: (TranslatableString | (error: { actual: number, min: number }) => TranslatableString)
minDate?: (TranslatableString | (error: { actual: Date, min: Date }) => TranslatableString)
minLength?: (TranslatableString | (error: { actualLength: number, requiredLength: number }) => TranslatableString)
numberFormat?: (TranslatableString | (error: { numberFormat: boolean }) => TranslatableString)
pattern?: (TranslatableString | (error: { pattern: (string | RegExp) }) => TranslatableString)
required?: (TranslatableString | (error: { required: boolean }) => TranslatableString)
requiredTrue?: (TranslatableString | (error: { required: boolean }) => TranslatableString)
The error mapper is used to resolve an angular validation error to a TranslatableString . It will be merged with already existing error mappers.
Parameters
mapper: SiFormValidationErrorMapper

Properties
lgMinimum: number
mdMinimum: number
smMinimum: number
xlMinimum: number
xxlMinimum: number
Alias for SelectOption or SelectGroup
A select option
Properties
Whether this option is disabled.
disabled?: boolean
An optional icon.
icon?: string
The color of an icon.
iconColor?: string
A label to be shown for this option. Is optional if a custom template is provided or if the value should directly be rendered.
label?: TranslatableString
An optional stacked icon.
stackedIcon?: string
The color of a stacked icon.
stackedIconColor?: string
Defines this to be an option.
type: "option"
Used for typeahead functionality when filtering is disabled. If provided, this will be used, otherwise the innerText of the rendered element.
typeaheadLabel?: TranslatableString
The value if this option.
It will be used for formControls and the value property of this si-select .
The value will internally be checked on equality by using === .
So an app should either use string or ensure that same values are referentially equal.

value: T
A select option group
Properties
An optional key to identify this group in a custom template.
key?: string
A label to be shown as header for this group. Is optional if a custom template is provided.
label?: TranslatableString
All options that are part of this group.
options: SelectOption<T>[]
Defines this to be a group.
type: "group"
("false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog")
Possible values for the aria-haspopup attribute exposed by the combobox host of a custom select.
Constructor
() => {}
Properties
container: (SiFormContainerComponent<{ [ key: string ]: AbstractControl<any, any, any> } }> | null) = ...
control: Signal<(AbstractControl<any, any, any> | null | undefined)> implements SiFormFieldsetControl.control = ...
controlElementRef: Signal<(ElementRef<HTMLElement> | undefined)> = ...
Disables the automatic error printing. Error printing will be enabled by default in v46.
disableErrorPrinting: InputSignalWithTransform<boolean, unknown> = false
errors: WritableSignal<SiFormError[]> implements SiFormFieldsetControl.errors = ...
fieldControl: Signal<(SiFormItemControl | undefined)> = ...
fieldControlNative: WritableSignal<(SiFormItemControl | undefined)> = ...
fieldControlQuery: Signal<(SiFormItemControl | undefined)> = ...
fieldset: (SiFormFieldsetComponent | null) = ...
Maps validation errors of the contained control to custom messages.
formErrorMapper: InputSignal<(SiFormValidationErrorMapper | undefined)> = ...
hasRequiredValidator: WritableSignal<boolean> = ...
The label to be displayed in the form item. It will be translated if a translation key is available.
label: InputSignal<TranslatableString> = ...
A custom width value to be applied to the label. A value of 0 is allowed as well to visually hide away the label area.

Numbers will be converted to pixels. Using numbers is discouraged and might be dropped.

Example:
labelWidth="100px"
labelWidth: InputSignal<(string | number | undefined)> = ...
labelWidthCssVar: Signal<(string | undefined)> = ...
ngControl: Signal<(NgControl | undefined)> = ...
previousErrors?: (ValidationErrors | null)
printErrors: Signal<boolean> = ...
radioGroupName: Signal<(string | undefined)> implements SiFormFieldsetControl.radioGroupName = ...
required: Signal<boolean> implements SiFormFieldsetControl.required = ...
Defines that this form item is required for the overall form to be valid.
requiredInput: InputSignalWithTransform<boolean, unknown> = false
requiredTestControl: FormControl<(string | null)> = ...
requiredValidator: Signal<(RequiredValidator | undefined)> = ...
touched: WritableSignal<boolean> implements SiFormFieldsetControl.touched = ...
validationErrorService: SiFormValidationErrorService = ...
validator?: (ValidatorFn | null)
Accessors
get formItemErrormessageId: (string | null)
get formItemId: (string | null)
get formItemLabelledBy: (string | null)
Methods
A callback method that is invoked immediately after the default change detector has completed checking all of the directive's content.
ngAfterContentChecked: () => void from AfterContentChecked.ngAfterContentChecked
A callback method that is invoked immediately after Angular has completed initialization of all of the directive's content. It is invoked only once when the directive is instantiated.
ngAfterContentInit: () => void from AfterContentInit.ngAfterContentInit
(changes: { control: SimpleChange<Signal<(AbstractControl<any, any, any> | null | undefined)>>, disableErrorPrinting: false, errors: SimpleChange<WritableSignal<SiFormError[]>>, formErrorMapper: SimpleChange<(SiFormValidationErrorMapper | undefined)>, label: SimpleChange<TranslatableString>, labelWidth: SimpleChange<(string | number | undefined)>, ngAfterContentChecked: SimpleChange<() => void>, ngAfterContentInit: SimpleChange<() => void>, ngControl: SimpleChange<Signal<(NgControl | undefined)>>, ngOnChanges: SimpleChange<(changes: { readonly label?: SimpleChange<TranslatableString> | undefined; readonly labelWidth?: SimpleChange<string | number | undefined> | undefined; ... 13 more ...; ngOnDestroy?: SimpleChange<...> | undefined; }) => void>, ngOnDestroy: SimpleChange<() => void>, ngOnInit: SimpleChange<() => void>, radioGroupName: SimpleChange<Signal<(string | undefined)>>, required: SimpleChange<Signal<boolean>>, requiredInput: false, touched: SimpleChange<WritableSignal<boolean>> }) => void from OnChanges.ngOnChanges
A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.
Parameters
The changed properties.
changes: { control: SimpleChange<Signal<(AbstractControl<any, any, any> | null | undefined)>>, disableErrorPrinting: false, errors: SimpleChange<WritableSignal<SiFormError[]>>, formErrorMapper: SimpleChange<(SiFormValidationErrorMapper | undefined)>, label: SimpleChange<TranslatableString>, labelWidth: SimpleChange<(string | number | undefined)>, ngAfterContentChecked: SimpleChange<() => void>, ngAfterContentInit: SimpleChange<() => void>, ngControl: SimpleChange<Signal<(NgControl | undefined)>>, ngOnChanges: SimpleChange<(changes: { readonly label?: SimpleChange<TranslatableString> | undefined; readonly labelWidth?: SimpleChange<string | number | undefined> | undefined; ... 13 more ...; ngOnDestroy?: SimpleChange<...> | undefined; }) => void>, ngOnDestroy: SimpleChange<() => void>, ngOnInit: SimpleChange<() => void>, radioGroupName: SimpleChange<Signal<(string | undefined)>>, required: SimpleChange<Signal<boolean>>, requiredInput: false, touched: SimpleChange<WritableSignal<boolean>> }
A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.
ngOnDestroy: () => void from OnDestroy.ngOnDestroy
A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.
ngOnInit: () => void from OnInit.ngOnInit
updateRequiredState: () => void
updateValidationMessages: () => void
<(TControl: { [ K in keyof TControl ]: AbstractControl })>
Class
▶
Deprecated: This component should no longer be used.

When providing a form wide error mapper, use the provideFormValidationErrorMapper .
import { provideFormValidationErrorMapper } form '@siemens/element-ng/forms'

@Component({
  template: `<form>...</form>`
  providers: [provideFormValidationErrorMapper({
    'name.required': 'CUSTOM_REQUIRED_ERROR'
  })]
})
class MyFormComponent {}


When using the column layout, use the form-col-layout classes.

<!-- Responsive column layout -->
<form class="responsive-form-col-layout">...</form>
<!-- Always column layout -->
<form class="form-col-layout">...</form>


For a custom breakpoint use the SCSS mixin:

scss
@use '@siemens/element-theme/src/styles/bootstrap/mixins/form-layout';

// Custom responsive breakpoint
.custom-form-col-layout {
  // Above 400px the column layout is used
  @include form-layout.responsive-form-col-layout(400px);
}
Constructor
() => {}
Properties
The container hosts the form within a siResizeContainer to configure the breakpoint for different screen sizes. Optionally, change the container breakpoints with the contentContainerBreakpoints input.
contentContainerBreakpoints: InputSignal<(Breakpoints | undefined)> = ...
A map the maps from control names of the form to their translate keys. The initial map is empty and the user is responsible to add the required translate keys.
controlNameTranslateKeyMap: InputSignal<Map<string, string>> = new Map<​string, string​>()
In some scenarios, one may not want the form container to be responsible for the layout relevant si-container-[xs|...] classes, but let this be done by a different, nested component, e.g. by a group box. In these cases, the property should be set to true.
disableContainerBreakpoints: InputSignalWithTransform<boolean, unknown> = false
Disables the automatic error printing in all nested SiFormItemComponent . Error printing will be enabled by default in v46.
disableErrorPrinting: InputSignalWithTransform<boolean, unknown> = false
Every validation error has an errorCode. This map holds translate keys for error codes. The keys can be used to display a translated message for each validation error. The defaults old english readable key defaults for the Angular standard validators of the Validators class like min , max or required .

Use the input to set your own translate keys for the form validators you need.

errorCodeTranslateKeyMap: InputSignal<(SiFormValidationErrorMapper | Map<string, string> | undefined)> = ...
Set the form entity to the container to enable the overall form validation on in the form container edit panel.
form: InputSignal<(FormGroup<TControl> | undefined)> = ...
formErrorMapper: Signal<{ [ key: string ]: (string | (error: any) => string | undefined) } }> = ...
hasParentContainer: boolean = ...
A custom width value to be applied to all labels.

Example:
labelWidth="100px".
labelWidth: InputSignal<(string | undefined)> = ...
A form container in readonly mode is only displaying the form content without ability to change it. The edit panel with typically save and cancel buttons is hidden. Set to true to display the edit panel.
readonly: InputSignalWithTransform<boolean, unknown> = false
Accessors
Indicates whether the content editor message shall be styled as warning.
Returns true , if SiFormContainerComponent.userInteractedWithForm is true and the form is invalid.

get invalidFormContainerMessage: boolean
Indicates whether the user interacted with the form.
Returns true , if the user selected at least one form element and [blurred] https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event by losing focus again (e.g. by setting focus on another element), or by editing the content of a form element. Otherwise false .

get userInteractedWithForm: boolean
Indicates whether content editor message shall be styled as success.
Returns true , if SiFormContainerComponent.userInteractedWithForm is true and the form is valid.

get validFormContainerMessage: boolean
Methods
Parameters
controlName: string
Constructor
() => {}
Properties
errors: Signal<readonly SiFormError[]> = ...
formItems: WritableSignal<SiFormFieldsetControl[]> = ...
hasOnlyRadios: Signal<boolean> = ...
Switches all child inputs to inline mode
inline: InputSignalWithTransform<boolean, unknown> = false
isRequired: Signal<boolean> = ...
The label for the entire fieldset.
label: InputSignal<TranslatableString> = ...
labelId: string = ...
Overrides the parent label width.
labelWidth: InputSignal<(string | undefined)> = ...
Adds a required marker to the label
required: InputSignalWithTransform<boolean, unknown> = false
showErrors: Signal<boolean> = ...
labelIdCounter: number = 0
Methods
(item: SiFormFieldsetControl) => void
Parameters
item: SiFormFieldsetControl
(item: SiFormFieldsetControl) => void
Parameters
item: SiFormFieldsetControl

Except where otherwise noted, content on this site is licensed under MIT License.