Select

Select a value from a list of options.

Installation

npx nx g @spartan-ng/cli:ui select

Usage

import { Component } from '@angular/core';
import { BrnSelectImports } from '@spartan-ng/brain/select';
import { HlmSelectImports } from '@spartan-ng/helm/select';
<brn-select class="inline-block" placeholder="Select an option">
	<hlm-select-trigger>
		<hlm-select-value />
	</hlm-select-trigger>
	<hlm-select-content class="w-56">
			<hlm-option value="Refresh">Refresh</hlm-option>
			<hlm-option value="Settings">Settings</hlm-option>
			<hlm-option value="Help">Help</hlm-option>
			<hlm-option value="Signout">Sign out</hlm-option>
	</hlm-select-content>
</brn-select>
@import '@angular/cdk/overlay-prebuilt.css';

Brain API

BrnSelectScrollUp

Selector: [brnSelectScrollUp], brn-select-scroll-up, hlm-select-scroll-up:not(noHlm)

BrnSelectScrollDown

Selector: [brnSelectScrollDown], brn-select-scroll-down, hlm-select-scroll-down:not(noHlm)

BrnSelectContent

Selector: brn-select-content, hlm-select-content:not(noHlm)

BrnSelectGroup

Selector: [brnSelectGroup]

BrnSelectLabel

Selector: [brnSelectLabel]

BrnSelectOption

Selector: [brnOption]

Inputs

PropTypeDefaultDescription
id unknown `brn-option-${nextId++}` -
value T --
disabled boolean false -

BrnSelectPlaceholder

Selector: [brnSelectPlaceholder], [hlmSelectPlaceholder]

BrnSelectTrigger

Selector: [brnSelectTrigger]

BrnSelectValueTemplate

Selector: [brnSelectValue], [hlmSelectValue]

BrnSelectValue

Selector: brn-select-value, hlm-select-value

Inputs

PropTypeDefaultDescription
transformFn (values: (string | undefined)[]) => any , -

BrnSelect

Selector: brn-select, hlm-select

Inputs

PropTypeDefaultDescription
id string `brn-select-${nextId++}` -
multiple boolean false -
placeholder string --
disabled boolean false -
dir BrnReadDirection ltr -
closeDelay number 100 -
compareWith (o1: T, o2: T) => boolean (o1, o2) => o1 === o2 -
open boolean false -
value T | T[] --

Outputs

PropTypeDefaultDescription
openChanged boolean false -
valueChanged T | T[] --

SelectNgModel

Selector: select-ngmodel-form

SelectReactiveField

Selector: select-reactive-field-fixture

SelectSingleValueTest

Selector: select-reactive-field-fixture

SelectSingleValueWithInitialValueTest

Selector: select-reactive-field-fixture

SelectSingleValueWithInitialValueWithAsyncUpdateTest

Selector: select-reactive-field-fixture

SelectMultiValueTest

Selector: select-reactive-field-fixture

SelectMultiValueWithInitialValueTest

Selector: select-reactive-field-fixture

SelectMultiValueWithInitialValueWithForLoopTest

Selector: select-reactive-field-fixture

Helm API

HlmSelectContent

Selector: [hlmSelectContent], hlm-select-content

Inputs

PropTypeDefaultDescription
class ClassValue --
stickyLabels boolean false -

HlmSelectGroup

Selector: [hlmSelectGroup], hlm-select-group

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelectLabel

Selector: [hlmSelectLabel], hlm-select-label

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelectOption

Selector: hlm-option

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelectScrollDown

Selector: hlm-select-scroll-down

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelectScrollUp

Selector: hlm-select-scroll-up

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelectTrigger

Selector: hlm-select-trigger

Inputs

PropTypeDefaultDescription
class ClassValue --
size 'default' | 'sm' default -

HlmSelectValue

Selector: hlm-select-value,[hlmSelectValue], brn-select-value[hlm]

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmSelect

Selector: hlm-select, brn-select [hlm]

Inputs

PropTypeDefaultDescription
class ClassValue --

Examples

Multiple

Scrollable with Groups

Value Template

Separator Scroll Area