Scrollable
<Scrollable>
is a component container for creating scrollable areas in the UI. Scrollbars can be both vertical and horizontal.
Usage
This component is commonly used in applications to manage large amounts of information or data, providing a convenient way for users to explore content without overwhelming the available screen space. The children
of the <Scrollable>
will scroll inside the container.
By default, the width
is set to 100%, you can change the width
to get a horizontal scrollbar. Same you can achieve with the height
property. By default this takes the available height.
The <Scrollable>
component can be used with every other component where content is overflowing the container, e.g. <Card>
, <Table>
, etc.
Vertical Scrolling
To use the vertical scrollbar you need to set the height
prop and the content has to overflow the container.
Horizontal Scrolling
To use horizontal scrolling, you need to wrap the content in a Flexbox using flex
. By default, the width
prop is set to 100%.
Here too, the content must extend beyond the container for the scroll bar to be displayed.
Props
aria-describedby?
string;
aria-details?
string;
aria-label?
string;
aria-labelledby?
string;
aria-live?
"off" | "polite" | "assertive";
- 'off': Updates are not announced unless focused.
- 'polite': Updates are announced when the user is idle.
- 'assertive': Updates are announced immediately, interrupting other announcements.
children?
ReactNode;
height?
HeightProp;
id?
string;
role?
"region" | (string & {});
region
is used as a role, an aria-label
or aria-labelledby
must be provided.
See MDN.width?
WidthProp;
"full"