@@ -63,6 +63,7 @@ import { Observable } from "rxjs";
6363 'cds--list-box--md': size === 'md',
6464 'cds--list-box--lg': size === 'lg',
6565 'cds--list-box--disabled': disabled,
66+ 'cds--combo-box--readonly': readonly,
6667 'cds--combo-box--warning cds--list-box--warning': warn
6768 }"
6869 class="cds--list-box cds--combo-box"
@@ -74,7 +75,7 @@ import { Observable } from "rxjs";
7475 <div
7576 *ngIf="type === 'multi' && pills.length > 0"
7677 class="cds--tag cds--tag--filter cds--tag--high-contrast"
77- [ngClass]="{'cds--tag--disabled': disabled}">
78+ [ngClass]="{'cds--tag--disabled': disabled || readonly }">
7879 <span class="cds--tag__label">{{ pills.length }}</span>
7980 <button
8081 type="button"
@@ -84,7 +85,7 @@ import { Observable } from "rxjs";
8485 class="cds--tag__close-icon"
8586 tabindex="0"
8687 [title]="clearSelectionsTitle"
87- [disabled]="disabled"
88+ [disabled]="disabled || readonly "
8889 [attr.aria-label]="clearSelectionAria">
8990 <svg
9091 focusable="false"
@@ -106,6 +107,7 @@ import { Observable } from "rxjs";
106107 autocomplete="off"
107108 role="combobox"
108109 [disabled]="disabled"
110+ [readOnly]="readonly"
109111 (input)="onSearch($event.target.value)"
110112 (blur)="onBlur()"
111113 (keydown.enter)="onSubmit($event)"
@@ -362,6 +364,10 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
362364 * Set to `true` to disable combobox.
363365 */
364366 @Input ( ) disabled = false ;
367+ /**
368+ * Set to `true` for readonly state.
369+ */
370+ @Input ( ) readonly = false ;
365371 /**
366372 * Emits a ListItem
367373 *
@@ -697,7 +703,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
697703 * Opens the dropdown.
698704 */
699705 public openDropdown ( ) {
700- if ( this . disabled ) { return ; }
706+ if ( this . disabled || this . readonly ) { return ; }
701707 this . open = true ;
702708 this . _dropUp = false ;
703709
@@ -778,7 +784,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
778784 event . stopPropagation ( ) ;
779785 event . preventDefault ( ) ;
780786
781- if ( this . disabled ) {
787+ if ( this . disabled || this . readonly ) {
782788 return ;
783789 }
784790
0 commit comments