Scroll Area
ScrollArea draws its own scrollbars over the browser's native scrolling.
Use a ScrollArea when content needs to scroll inside a box, such as a long list in a card or a panel. The browser still does the scrolling, so the wheel, trackpad, touch and keyboard behave as usual, while a slim rounded bar is drawn over the content instead of the browser's own scrollbar.
The bar appears while you scroll or point at the area and is hidden the rest of the time. It takes up no space, and it appears only for a direction that has more content, so you never choose horizontal or vertical.
A ScrollArea needs a limit before it can scroll. Give it a height or maxHeight through style, or put it inside a Shell pane or another container with a fixed height. Without a limit it grows with its content.
Set fade to fade the content out at any edge that has more content beyond it. When a ScrollArea is the only child of a Card or another surface, it reaches the surface's edges and moves the surface's padding inside itself.
When its content overflows, a ScrollArea is a tab stop, so keyboard users can focus it and scroll with the arrow keys. Name it with aria-label or aria-labelledby, and screen readers announce it as a region. Set focusable={false} only inside a component that already handles scrolling from the keyboard, such as a menu.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
aria-label? | string | The accessible name of the scroll area. |
aria-labelledby? | string | The id of an element that names the scroll area, usually a heading above it. |
children? | React.ReactNode | The content that scrolls. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
fade? | boolean | Fades the content at each edge that has more content beyond it. |
focusable? | boolean | Whether keyboard users can tab to the scroll area. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
size— The scrollbar has one designed thickness. The size of the scrolling area comes from the height you give it.toneandemphasis— A scrollbar only shows where you are in the content, so it carries no colour meaning and nothing to rank.material— A ScrollArea sits inside a pane, and that pane already uses the theme's material.render— A ScrollArea is made of several nested elements that must stay in a fixed structure. Wrap it in your own element when you need one around it.orientation— The scrollbar appears for whichever direction actually overflows, so there is nothing to choose.