How add custom class name to ng-select2 container

I would like add custom class name to ng-select container.

I have select element like below:

 <ng-select
    name="symbolPairsId"
    formControlName="symbolPairsId"
    id="symbolPairsId"
    [items]="setupTags"
    bindLabel="name"
    bindValue="id"
    [closeOnSelect]="true"
    [hideSelected]="true"
    multiple="true" ></ng-select>

and try to add custom class like this:

containerClass="success"

but doesn’t work.what is the recommended way of doing this?

Thanks

>Solution :

ng-select does not have property called containerClass,
You can override default style by using class selector

component.html

<ng-select class="customClass"></ng-select>

component.scss

.ng-select.customClass ::ng-deep .ng-select-container  {            
    min-height: 0px;
    border-radius: 0;
}

Reference

Leave a Reply