Ng-select: Giving input box a "small" style

Created on 18 Mar 2018  路  4Comments  路  Source: ng-select/ng-select

I am trying to decrease the style of the select box to match the Bootstrap 4 "custom-select-sm" style.
I have tried all morning to affect the height using the suggested way via

.ng-select.custom { height: 20px; } .ng-select.custom .ng-control { height: 20px; }

and by adding

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

to my html, but the only thing I am able to affect are font sizes and the line-height once the select dropdown pops up. However, I fail to decrease the height of the actual box (increasing the box size works via line-height, e.g. line-height; 80px; )

Does anyone have a solution or an idea what I am missing?

question

Most helpful comment

Thank you, I got it now. Problem was that I placed the custom css in the component's scss file not in the application wide styles.scss. Putting the code there does have the desired effect :)

All 4 comments

just override both, height and min-height

.ng-select.custom .ng-control {
  min-height: 20px;
  height: 20px;
}

Thanks for your response. Your suggestion does not work though. Here is my code:

In my html:

    <div class="form-group col-md-6">
      <label>Core(s)</label>
      <ng-select class="custom"
      [items]="host.cores" 
      [multiple]="true"
      [closeOnSelect]="false"
      [virtualScroll]="true" 
      [dropdownPosition]="'top'"
      placeholder="Select core(s)"
      formControlName="cpuCores">
      </ng-select>
    </div>

In the component's scss

.ng-select.custom .ng-control {
  min-height: 20px;
  height: 20px;
}

Thank you, I got it now. Problem was that I placed the custom css in the component's scss file not in the application wide styles.scss. Putting the code there does have the desired effect :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamal890 picture shyamal890  路  3Comments

musman92 picture musman92  路  3Comments

iantrudell picture iantrudell  路  3Comments

mi1olson picture mi1olson  路  4Comments

penihel picture penihel  路  4Comments