Taiga UI 5 is out!

ScrollWheel EXPERIMENTAL

Examples API GitHub

On this page

Work in progress, do not use!
There are known issues in Safari, as always

A component for spinning wheels or other infinitely scrollable containers, not to be confused with virtual scrolling which typically has ends.

Basic

Each item can have arbitrary height
-10
-9
-8
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
8
9
10
    
      
    
    
      <tui-scroll-wheel [style.block-size.rem]="20">
    <div
        *tuiItem="let index"
        [style.background]="getHeight(index).toString() | tuiAutoColor"
        [style.block-size.px]="getHeight(index)"
    >
        {{ index }}
    </div>
</tui-scroll-wheel>

    

Scroll snapping

Use bigger buffer for smaller items to avoid flickering at high speeds
20
21
22
23
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
:
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

Selected: 00:00

    
      
    
    
      <tui-scroll-wheel
    waIntersectionThreshold="0.5"
    [buffer]="50"
    [(index)]="hours"
>
    <ng-template let-index>
        <div [class._current]="index - 2 === hours()">{{ getHours(index) }}</div>
    </ng-template>
</tui-scroll-wheel>
:
<tui-scroll-wheel
    waIntersectionThreshold="0.5"
    [buffer]="50"
    [(index)]="minutes"
>
    <ng-template let-index>
        <div [class._current]="index - 2 === minutes()">{{ getMinutes(index) }}</div>
    </ng-template>
</tui-scroll-wheel>
<p>
    <output>Selected: {{ getHours(hours() + 2) }}:{{ getMinutes(minutes() + 2) }}</output>
</p>

    
    
      @import '@taiga-ui/styles/utils.less';

:host {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    font: var(--tui-typography-heading-h6);
    place-items: center;
}

tui-scroll-wheel {
    block-size: 15rem;
    mask-image: linear-gradient(transparent, black 7.5rem, transparent);
    justify-self: start;

    &:first-child {
        justify-self: end;
    }
}

div {
    .transition(color);

    display: flex;
    align-items: center;
    justify-content: center;
    block-size: 3rem;
    font: var(--tui-typography-heading-h6);
    font-variant: tabular-nums;
    scroll-snap-align: start;
    color: var(--tui-text-tertiary);

    &._current {
        color: var(--tui-text-primary);
    }
}

p {
    grid-column: 1 / -1;
}