Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single line horizontal chip list in Material Angular 6

How does one create a horizontal chip list in Material Angular that scrolls horizontally instead of taking up multiple rows?

like image 715
Eliezer Steinbock Avatar asked Oct 14 '18 17:10

Eliezer Steinbock


1 Answers

This code solved our problem:

(We also used encapsulation: ViewEncapsulation.None on our component).

::-webkit-scrollbar {
  height: 0;
}

div.mat-chip-list-wrapper {
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 165px;
  white-space: nowrap;

  .mat-chip {
    flex: 0 0 auto;

    background: transparent;
    color: var(--white);
  }
}

.mat-chip-list {
  margin-left: 20px;
}

.mat-chip.mat-standard-chip .mat-chip-remove {
  color: var(--white);
}
like image 126
Eliezer Steinbock Avatar answered Sep 22 '22 22:09

Eliezer Steinbock