Skip to content

Commit 21e09a8

Browse files
authored
ui: increase width and allow long dropdown items to wrap (#5194)
The 'tb-dropdown' widget now better handles items that are very long. The dropdown menu width grows to fit content, up to a point, and longer text will wrap. Googlers, see b/193896469, and cl/388827477 for more.
1 parent b9b5b9d commit 21e09a8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tensorboard/webapp/widgets/dropdown/dropdown_component.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@ mat-select:focus {
2727
outline-color: -webkit-focus-ring-color;
2828
outline-style: auto;
2929
}
30+
31+
::ng-deep .mat-select-panel {
32+
max-width: 70vw;
33+
}
34+
35+
.tb-mat-option {
36+
// Overrides Angular Material's fixed height.
37+
height: auto;
38+
}
39+
40+
::ng-deep .mat-option-text {
41+
white-space: normal;
42+
word-break: break-all;
43+
}

tensorboard/webapp/widgets/dropdown/dropdown_component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface DropdownOption {
3535
>
3636
<mat-option
3737
*ngFor="let option of options"
38+
class="tb-mat-option"
3839
[value]="option.value"
3940
[disabled]="option.disabled"
4041
>

0 commit comments

Comments
 (0)