Scroll Area
A scrollable container with customized scrollbar styling.
Basic Usage
dart
1
2
3
4
5
6
7
DScrollArea(
maxHeight: '200px',
children: [
for (var i = 1; i <= 20; i++)
p(classes: 'py-2', [Component.text('Item $i')]),
],
)
Orientation
dart
1
2
3
4
5
6
7
8
9
DScrollArea(
orientation: DScrollOrientation.horizontal,
children: [
div(classes: 'flex gap-4 p-4', [
for (var i = 1; i <= 10; i++)
div(classes: 'w-32 h-24 bg-zinc-800 rounded-lg', [...]),
]),
],
)
Scrollbar Visibility
Always visible:
On hover:
dart
1
2
3
4
5
6
7
8
9
10
11
12
13
// Always visible
DScrollArea(
scrollbarVisibility: DScrollbarVisibility.always,
maxHeight: '120px',
children: [...],
)
// On hover
DScrollArea(
scrollbarVisibility: DScrollbarVisibility.hover,
maxHeight: '120px',
children: [...],
)
Both Directions
dart
1
2
3
4
5
6
7
8
DScrollArea(
orientation: DScrollOrientation.both,
maxHeight: '200px',
maxWidth: '400px',
children: [
div(classes: 'w-[600px] h-[400px]', [...]),
],
)