Scroll Area
A native scroll container with custom scrollbars.
Vernacular architecture is building done outside any academic tradition, and without professional guidance. It is not a particular architectural movement or style, but rather a broad category, encompassing a wide range and variety of building types, with differing methods of construction, from around the world, both historical and extant and classical and modern. Vernacular architecture constitutes 95% of the world's built environment, as estimated in 1995 by Amos Rapoport, as measured against the small percentage of new buildings every year designed by architects and built by engineers.
This type of architecture usually serves immediate, local needs, is constrained by the materials available in its particular region and reflects local traditions and cultural practices. The study of vernacular architecture does not examine formally schooled architects, but instead that of the design skills and tradition of local builders, who were rarely given any attribution for the work. More recently, vernacular architecture has been examined by designers and the building industry in an effort to be more energy conscious with contemporary design and construction—part of a broader interest in sustainable design.
Anatomy
Import the component and assemble its parts:
Examples
Both scrollbars
Use <ScrollArea.Corner> to prevent the scrollbars from intersecting.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 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
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
Gradient scroll fade
Use the viewport overflow CSS variables to drive a CSS mask, which gradually increases the fade as the user scrolls away from the edges.
For SSR, a fallback can be used as part of the end-side var() call so the mask is visible before the overflow CSS variables hydrate.
When the fade is applied to <ScrollArea.Viewport> itself, the variables can be used directly. However, inheritance to children is disabled, so they must explicitly opt-in using the inherit keyword.
Vernacular architecture is building done outside any academic tradition, and without professional guidance. It is not a particular architectural movement or style, but rather a broad category, encompassing a wide range and variety of building types, with differing methods of construction, from around the world, both historical and extant and classical and modern. Vernacular architecture constitutes 95% of the world's built environment, as estimated in 1995 by Amos Rapoport, as measured against the small percentage of new buildings every year designed by architects and built by engineers.
This type of architecture usually serves immediate, local needs, is constrained by the materials available in its particular region and reflects local traditions and cultural practices. The study of vernacular architecture does not examine formally schooled architects, but instead that of the design skills and tradition of local builders, who were rarely given any attribution for the work. More recently, vernacular architecture has been examined by designers and the building industry in an effort to be more energy conscious with contemporary design and construction—part of a broader interest in sustainable design.
Combining with Tabs
Use <Tabs.List>’s render prop to render <ScrollArea.Viewport> directly when the tab list itself needs the viewport overflow values for a mask fade. This keeps the mask logic on the same element that receives the scroll state.
API reference
Root
Groups all parts of the scroll area.
Renders a <div> element.
overflowEdgeThresholdUnion0
- Description
The threshold in pixels that must be passed before the overflow edge attributes are applied. Accepts a single number for all edges or an object to configure them individually.
- Type
- Default
0
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-has-overflow-x
Present when the scroll area content is wider than the viewport.
data-has-overflow-y
Present when the scroll area content is taller than the viewport.
data-overflow-x-end
Present when there is overflow on the horizontal end side.
data-overflow-x-start
Present when there is overflow on the horizontal start side.
data-overflow-y-end
Present when there is overflow on the vertical end side.
data-overflow-y-start
Present when there is overflow on the vertical start side.
data-scrolling
Present when the user scrolls inside the scroll area.
Attribute | Description | |
|---|---|---|
data-has-overflow-x | Present when the scroll area content is wider than the viewport. | |
data-has-overflow-y | Present when the scroll area content is taller than the viewport. | |
data-overflow-x-end | Present when there is overflow on the horizontal end side. | |
data-overflow-x-start | Present when there is overflow on the horizontal start side. | |
data-overflow-y-end | Present when there is overflow on the vertical end side. | |
data-overflow-y-start | Present when there is overflow on the vertical start side. | |
data-scrolling | Present when the user scrolls inside the scroll area. | |
--scroll-area-corner-height
The scroll area’s corner height.
--scroll-area-corner-width
The scroll area’s corner width.
CSS Variable | Description | |
|---|---|---|
--scroll-area-corner-height | The scroll area’s corner height. | |
--scroll-area-corner-width | The scroll area’s corner width. | |
ScrollArea.Root.StateHide
Viewport
The actual scrollable container of the scroll area.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-has-overflow-x
Present when the scroll area content is wider than the viewport.
data-has-overflow-y
Present when the scroll area content is taller than the viewport.
data-overflow-x-end
Present when there is overflow on the horizontal end side.
data-overflow-x-start
Present when there is overflow on the horizontal start side.
data-overflow-y-end
Present when there is overflow on the vertical end side.
data-overflow-y-start
Present when there is overflow on the vertical start side.
data-scrolling
Present when the user scrolls inside the scroll area.
Attribute | Description | |
|---|---|---|
data-has-overflow-x | Present when the scroll area content is wider than the viewport. | |
data-has-overflow-y | Present when the scroll area content is taller than the viewport. | |
data-overflow-x-end | Present when there is overflow on the horizontal end side. | |
data-overflow-x-start | Present when there is overflow on the horizontal start side. | |
data-overflow-y-end | Present when there is overflow on the vertical end side. | |
data-overflow-y-start | Present when there is overflow on the vertical start side. | |
data-scrolling | Present when the user scrolls inside the scroll area. | |
--scroll-area-overflow-x-end
The distance from the horizontal end edge in pixels.
--scroll-area-overflow-x-start
The distance from the horizontal start edge in pixels.
--scroll-area-overflow-y-end
The distance from the vertical end edge in pixels.
--scroll-area-overflow-y-start
The distance from the vertical start edge in pixels.
CSS Variable | Description | |
|---|---|---|
--scroll-area-overflow-x-end | The distance from the horizontal end edge in pixels. | |
--scroll-area-overflow-x-start | The distance from the horizontal start edge in pixels. | |
--scroll-area-overflow-y-end | The distance from the vertical end edge in pixels. | |
--scroll-area-overflow-y-start | The distance from the vertical start edge in pixels. | |
ScrollArea.Viewport.StateHide
Content
A container for the content of the scroll area.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-has-overflow-x
Present when the scroll area content is wider than the viewport.
data-has-overflow-y
Present when the scroll area content is taller than the viewport.
data-overflow-x-end
Present when there is overflow on the horizontal end side.
data-overflow-x-start
Present when there is overflow on the horizontal start side.
data-overflow-y-end
Present when there is overflow on the vertical end side.
data-overflow-y-start
Present when there is overflow on the vertical start side.
data-scrolling
Present when the user scrolls inside the scroll area.
Attribute | Description | |
|---|---|---|
data-has-overflow-x | Present when the scroll area content is wider than the viewport. | |
data-has-overflow-y | Present when the scroll area content is taller than the viewport. | |
data-overflow-x-end | Present when there is overflow on the horizontal end side. | |
data-overflow-x-start | Present when there is overflow on the horizontal start side. | |
data-overflow-y-end | Present when there is overflow on the vertical end side. | |
data-overflow-y-start | Present when there is overflow on the vertical start side. | |
data-scrolling | Present when the user scrolls inside the scroll area. | |
ScrollArea.Content.StateHide
Scrollbar
A vertical or horizontal scrollbar for the scroll area.
Renders a <div> element.
orientation'vertical' | 'horizontal''vertical'
- Name
- Description
Whether the scrollbar controls vertical or horizontal scroll.
- Type
- Default
'vertical'
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
keepMountedbooleanfalse
- Name
- Description
Whether to keep the HTML element in the DOM when the viewport isn’t scrollable.
- Type
- Default
false
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-orientation
Indicates the orientation of the scrollbar.
data-has-overflow-x
Present when the scroll area content is wider than the viewport.
data-has-overflow-y
Present when the scroll area content is taller than the viewport.
data-hovering
Present when the pointer is over the scroll area.
data-overflow-x-end
Present when there is overflow on the horizontal end side.
data-overflow-x-start
Present when there is overflow on the horizontal start side.
data-overflow-y-end
Present when there is overflow on the vertical end side.
data-overflow-y-start
Present when there is overflow on the vertical start side.
data-scrolling
Present when the user scrolls inside the scroll area.
Attribute | Description | |
|---|---|---|
data-orientation | Indicates the orientation of the scrollbar. | |
data-has-overflow-x | Present when the scroll area content is wider than the viewport. | |
data-has-overflow-y | Present when the scroll area content is taller than the viewport. | |
data-hovering | Present when the pointer is over the scroll area. | |
data-overflow-x-end | Present when there is overflow on the horizontal end side. | |
data-overflow-x-start | Present when there is overflow on the horizontal start side. | |
data-overflow-y-end | Present when there is overflow on the vertical end side. | |
data-overflow-y-start | Present when there is overflow on the vertical start side. | |
data-scrolling | Present when the user scrolls inside the scroll area. | |
--scroll-area-thumb-height
The scroll area thumb’s height.
--scroll-area-thumb-width
The scroll area thumb’s width.
CSS Variable | Description | |
|---|---|---|
--scroll-area-thumb-height | The scroll area thumb’s height. | |
--scroll-area-thumb-width | The scroll area thumb’s width. | |
ScrollArea.Scrollbar.StateHide
Thumb
The draggable part of the scrollbar that indicates the current scroll position.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-orientation
Indicates the orientation of the scrollbar.
data-scrolling
Present when the user scrolls inside the scroll area.
Attribute | Description | |
|---|---|---|
data-orientation | Indicates the orientation of the scrollbar. | |
data-scrolling | Present when the user scrolls inside the scroll area. | |
ScrollArea.Thumb.StateHide
Corner
A small rectangular area that appears at the intersection of horizontal and vertical scrollbars.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type