@@ -8,16 +8,18 @@ import {
88 ReactiveFormsModule ,
99 type ValidationErrors
1010} from '@angular/forms' ;
11- import { type Form } from '@sl-design-system/form' ;
11+ import { Form } from '@sl-design-system/form' ;
1212import { type Meta , type StoryFn , moduleMetadata } from '@storybook/angular' ;
1313import { ButtonComponent } from '../src/button/button.component' ;
1414import { ButtonBarComponent } from '../src/button-bar/button-bar.component' ;
1515import { CheckboxGroupComponent } from '../src/checkbox/checkbox-group.component' ;
1616import { CheckboxComponent } from '../src/checkbox/checkbox.component' ;
17+ import { ComboboxComponent } from '../src/combobox/combobox.component' ;
1718import { FormFieldComponent } from '../src/form/form-field.component' ;
1819import { FormComponent } from '../src/form/form.component' ;
1920import { CheckboxGroupDirective } from '../src/forms/checkbox-group.directive' ;
2021import { CheckboxDirective } from '../src/forms/checkbox.directive' ;
22+ import { ComboboxDirective } from '../src/forms/combobox-directive' ;
2123import { NumberFieldDirective } from '../src/forms/number-field.directive' ;
2224import { RadioGroupDirective } from '../src/forms/radio-group.directive' ;
2325import { SelectDirective } from '../src/forms/select.directive' ;
@@ -62,6 +64,26 @@ import { TextFieldComponent } from '../src/text-field/text-field.component';
6264 </sl-select>
6365 </sl-form-field>
6466
67+ <sl-form-field label="Combobox - single select">
68+ <sl-combobox formControlName="comboboxSingle" placeholder="Select an option">
69+ <sl-listbox>
70+ @for (option of options(); track option.value) {
71+ <sl-option>{{ option.label }}</sl-option>
72+ }
73+ </sl-listbox>
74+ </sl-combobox>
75+ </sl-form-field>
76+
77+ <sl-form-field label="Combobox - multiple select">
78+ <sl-combobox formControlName="comboboxMultiple" multiple placeholder="Select one or more options">
79+ <sl-listbox>
80+ @for (option of options(); track option.value) {
81+ <sl-option>{{ option.label }}</sl-option>
82+ }
83+ </sl-listbox>
84+ </sl-combobox>
85+ </sl-form-field>
86+
6587 <sl-form-field label="Switch">
6688 <sl-switch formControlName="switch" reverse value="toggled">Toggle me</sl-switch>
6789 </sl-form-field>
@@ -90,6 +112,7 @@ import { TextFieldComponent } from '../src/text-field/text-field.component';
90112 ReactiveFormsModule ,
91113 CheckboxDirective ,
92114 CheckboxGroupDirective ,
115+ ComboboxDirective ,
93116 NumberFieldDirective ,
94117 RadioGroupDirective ,
95118 SelectDirective ,
@@ -102,6 +125,8 @@ export class AllFormControlsReactiveComponent {
102125 formGroup = new FormGroup ( {
103126 checkbox : new FormControl ( 'checked' ) ,
104127 checkboxGroup : new FormControl ( [ '2' , '1' , '0' ] ) ,
128+ comboboxSingle : new FormControl ( '' ) ,
129+ comboboxMultiple : new FormControl ( '' ) ,
105130 numberField : new FormControl ( 10 ) ,
106131 radioGroup : new FormControl ( '1' ) ,
107132 select : new FormControl ( '1' ) ,
@@ -151,6 +176,26 @@ export class AllFormControlsReactiveComponent {
151176 </sl-select>
152177 </sl-form-field>
153178
179+ <sl-form-field label="Combobox - single select">
180+ <sl-combobox formControlName="comboboxSingle" required>
181+ <sl-listbox>
182+ @for (option of options(); track option.value) {
183+ <sl-option>{{ option.label }}</sl-option>
184+ }
185+ </sl-listbox>
186+ </sl-combobox>
187+ </sl-form-field>
188+
189+ <sl-form-field label="Combobox - multiple select">
190+ <sl-combobox formControlName="comboboxMultiple" multiple required>
191+ <sl-listbox>
192+ @for (option of options(); track option.value) {
193+ <sl-option>{{ option.label }}</sl-option>
194+ }
195+ </sl-listbox>
196+ </sl-combobox>
197+ </sl-form-field>
198+
154199 <sl-form-field label="Switch">
155200 <sl-switch formControlName="switch" reverse>Toggle me</sl-switch>
156201 </sl-form-field>
@@ -185,6 +230,7 @@ export class AllFormControlsReactiveComponent {
185230 ButtonBarComponent ,
186231 CheckboxDirective ,
187232 CheckboxGroupDirective ,
233+ ComboboxDirective ,
188234 NumberFieldDirective ,
189235 RadioGroupDirective ,
190236 SelectDirective ,
@@ -199,6 +245,8 @@ export class AllFormControlsEmptyReactiveComponent {
199245 formGroup = new FormGroup ( {
200246 checkbox : new FormControl ( false ) ,
201247 checkboxGroup : new FormControl ( [ ] ) ,
248+ comboboxSingle : new FormControl ( '' ) ,
249+ comboboxMultiple : new FormControl ( '' ) ,
202250 numberField : new FormControl ( ) ,
203251 radioGroup : new FormControl ( '' ) ,
204252 select : new FormControl ( '' ) ,
@@ -252,6 +300,26 @@ export class AllFormControlsEmptyReactiveComponent {
252300 </sl-select>
253301 </sl-form-field>
254302
303+ <sl-form-field label="Combobox - single select">
304+ <sl-combobox [(ngModel)]="formGroup.comboboxSingle">
305+ <sl-listbox>
306+ <sl-option>Option 1</sl-option>
307+ <sl-option>Option 2</sl-option>
308+ <sl-option>Option 3</sl-option>
309+ </sl-listbox>
310+ </sl-combobox>
311+ </sl-form-field>
312+
313+ <sl-form-field label="Combobox - multiple select">
314+ <sl-combobox [(ngModel)]="formGroup.comboboxMultiple" multiple>
315+ <sl-listbox>
316+ <sl-option>Option 1</sl-option>
317+ <sl-option>Option 2</sl-option>
318+ <sl-option>Option 3</sl-option>
319+ </sl-listbox>
320+ </sl-combobox>
321+ </sl-form-field>
322+
255323 <sl-form-field label="Switch">
256324 <sl-switch [(ngModel)]="formGroup.switch" reverse value="toggled">Toggle me</sl-switch>
257325 </sl-form-field>
@@ -280,6 +348,7 @@ export class AllFormControlsEmptyReactiveComponent {
280348 FormsModule ,
281349 CheckboxDirective ,
282350 CheckboxGroupDirective ,
351+ ComboboxDirective ,
283352 NumberFieldDirective ,
284353 RadioGroupDirective ,
285354 SelectDirective ,
@@ -293,6 +362,8 @@ export class AllFormControlsTemplateComponent {
293362 textField : 'Text field' ,
294363 textArea : 'Text area' ,
295364 checkbox : 'checked' ,
365+ comboboxSingle : 'Option 1' ,
366+ comboboxMultiple : [ 'Option 1' , 'Option 2' ] ,
296367 numberField : 10 ,
297368 select : '1' ,
298369 switch : 'toggled' ,
@@ -329,6 +400,26 @@ export class AllFormControlsTemplateComponent {
329400 </sl-select>
330401 </sl-form-field>
331402
403+ <sl-form-field label="Combobox - single select">
404+ <sl-combobox [(ngModel)]="formGroup.comboboxSingle" required>
405+ <sl-listbox>
406+ <sl-option>Option 1</sl-option>
407+ <sl-option>Option 2</sl-option>
408+ <sl-option>Option 3</sl-option>
409+ </sl-listbox>
410+ </sl-combobox>
411+ </sl-form-field>
412+
413+ <sl-form-field label="Combobox - multiple select">
414+ <sl-combobox [(ngModel)]="formGroup.comboboxMultiple" multiple required>
415+ <sl-listbox>
416+ <sl-option>Option 1</sl-option>
417+ <sl-option>Option 2</sl-option>
418+ <sl-option>Option 3</sl-option>
419+ </sl-listbox>
420+ </sl-combobox>
421+ </sl-form-field>
422+
332423 <sl-form-field label="Switch">
333424 <sl-switch [(ngModel)]="formGroup.switch" reverse>Toggle me</sl-switch>
334425 </sl-form-field>
@@ -363,6 +454,7 @@ export class AllFormControlsTemplateComponent {
363454 ButtonBarComponent ,
364455 CheckboxDirective ,
365456 CheckboxGroupDirective ,
457+ ComboboxDirective ,
366458 NumberFieldDirective ,
367459 RadioGroupDirective ,
368460 SelectDirective ,
@@ -378,6 +470,8 @@ export class AllFormControlsEmptyTemplateComponent {
378470 textField : '' ,
379471 textArea : '' ,
380472 checkbox : false ,
473+ comboboxSingle : '' ,
474+ comboboxMultiple : [ ] ,
381475 numberField : '' ,
382476 select : '' ,
383477 switch : false ,
@@ -484,6 +578,7 @@ export default {
484578 LoginFormComponent ,
485579 CheckboxComponent ,
486580 CheckboxGroupComponent ,
581+ ComboboxComponent ,
487582 FormComponent ,
488583 FormFieldComponent ,
489584 NumberFieldComponent ,
0 commit comments