I am trying to use angular material matAutocomplete mat-options in bootstrap Navbar, here is my code
<li class="nav-item">
<form class="example-form">
<mat-form-field class="example-full-width">
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let option of options" [value]="option">
{{option}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>
</li>

You can see in snapshot first item of mat-options is under navbar. autocomplete example is working fine but suggestion box is appearing under the bootstrap how can I make mat-option on top of the navbar.
adding class .mat-option and z-index css property has no effect.
.mat-option{
z-index: 999;
}
Thanks in advance
you can do that in two ways. the only thing that you need to remember is if your navbar is having z-index more than 1000 it will overlap the matAutoComplete dropdown.
add this to your CSS file (preferred)
.navbar{
z-index: 1000 ; }
or this to your CSS file
.cdk-overlay-container{z-index: 10001 ;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With