Component to hide overflown items behind custom content.
<tui-items-with-more [required]="required">
@for (item of items; track item) {
<span
*tuiItem
appearance="neutral"
size="s"
tuiChip
class="tui-space_right-1"
>
{{ item }}
</span>
}
<ng-template
let-index
tuiMore
>
and {{ getRemaining(index) }} more
</ng-template>
</tui-items-with-more>
<tui-items-with-more
size="m"
tuiGroup
[collapsed]="true"
>
@for (item of items; track item) {
<label
*tuiItem
appearance=""
tuiBlock="m"
[style.border-radius]="'inherit'"
>
{{ item }}
<input
tuiBlock
type="checkbox"
[(ngModel)]="value[$index]"
/>
</label>
}
<ng-template
let-lastIndex
tuiMore
>
<button
appearance="outline-grayscale"
size="m"
tuiButton
tuiDropdownAlign="end"
tuiDropdownAuto
type="button"
class="item"
[tuiDropdown]="dropdown"
>
More
<div tuiBadge>{{ items.length - lastIndex - 1 }}</div>
</button>
<ng-template #dropdown>
<tui-data-list size="l">
@for (item of items; track item) {
@if ($index > lastIndex) {
<button
tuiOption
type="button"
(click)="value[$index] = !value[$index]"
>
{{ item }}
<tui-icon
icon="@tui.check"
class="tui-space_left-2"
[class._hidden]="!value[$index]"
/>
</button>
}
}
</tui-data-list>
</ng-template>
</ng-template>
</tui-items-with-more>
.item {
border-radius: inherit;
font-weight: normal;
}
._hidden {
visibility: hidden;
}
tui-icon {
inline-size: 1rem;
block-size: 1rem;
}
<tui-items-with-more
side="start"
[itemsLimit]="3"
>
@for (item of items; track item) {
<ng-container *tuiItem>
@if (!$first) {
<tui-icon
icon="@tui.chevron-right"
[style.font-size.rem]="1"
[style.opacity]="0.25"
[style.width.rem]="1.5"
/>
}
<button
appearance="flat"
size="xs"
tuiButton
type="button"
>
{{ item }}
</button>
</ng-container>
}
<ng-template
let-index
tuiMore
>
<button
appearance="flat"
iconStart="@tui.ellipsis"
size="xs"
tuiDropdownAuto
tuiIconButton
type="button"
[tuiDropdown]="dropdown"
>
More
</button>
<ng-template #dropdown>
<tui-data-list size="s">
@for (item of items; track item) {
@if ($index < index) {
<button
tuiOption
type="button"
>
{{ item }}
</button>
}
}
</tui-data-list>
</ng-template>
</ng-template>
</tui-items-with-more>
<tui-items-with-more
class="container"
[class.container_expanded]="linesLimit === 100"
[linesLimit]="linesLimit"
(lastIndexChange)="lastIndex = $event"
>
@for (item of items; track item) {
<span
*tuiItem
appearance="neutral"
size="s"
tuiChip
class="item"
[class.item_visible]="$index <= lastIndex"
>
{{ item }} item
</span>
}
<ng-template
let-index
tuiMore
>
<button
appearance="neutral"
iconEnd="@tui.chevron-down"
size="s"
tuiChip
type="button"
class="more"
(click)="linesLimit = 100"
>
More {{ getRemaining(index) }}
</button>
</ng-template>
</tui-items-with-more>
@import '@taiga-ui/styles/utils.less';
:host {
display: block;
max-inline-size: 30rem;
}
.container {
max-block-size: 4.5rem;
overflow: hidden;
&_expanded {
max-block-size: 100%;
}
}
.item {
.transition(~'transform, opacity');
opacity: 0;
transform: scale(0.9);
margin: 0 0.25rem 0.25rem 0;
&_visible {
opacity: 1;
transform: scale(1);
}
}
.more {
margin: 0 0.25rem 0.25rem 0;
}
<tui-textfield
tuiChevron
[content]="content"
[tuiTextfieldCleaner]="false"
>
<input
tuiSelect
[(ngModel)]="value"
/>
<tui-data-list-wrapper
*tuiDropdown
[itemContent]="content"
[items]="items"
/>
<ng-template
#content
let-item
>
<span tuiAvatar="@tui.star"></span>
<span tuiTitle>
<tui-items-with-more tuiSubtitle>
<span *tuiItem>{{ item.name }}</span>
<span *tuiItem> • {{ item.number }}</span>
<div *tuiMore="let index">
@if (index < 0) {
<span>{{ item.name }}</span>
}
<span> *{{ item.number.slice(-4) }}</span>
</div>
</tui-items-with-more>
${{ item.value | tuiFormatNumber }}
</span>
</ng-template>
</tui-textfield>
[tuiCell],
[tuiTitle] {
flex: 1;
}
div {
display: flex;
}
span:first-child {
overflow: hidden;
text-overflow: ellipsis;
}