JumboScrollbar
JumboScrollbar is a styled scrollable container from the @jumbo framework. It renders a div
with custom scrollbar styling that matches the active MUI theme, replacing the default OS
scrollbar with a thin, non-obtrusive overlay scrollbar.
Usage
Wrap any overflowing content with JumboScrollbar. It is most commonly used inside the sidebar
to make the navigation list scrollable:
// src/components/Sidebar/Sidebar.tsx (excerpt)
import { JumboScrollbar } from '@jumbo/components/JumboScrollbar';
import { JumboNavbar } from '@jumbo/components/JumboNavbar';
export function Sidebar() {
return (
<JumboScrollbar
autoHide
autoHideDuration={200}
style={{ height: '100%' }}
>
<JumboNavbar />
</JumboScrollbar>
);
}Props
JumboScrollbar extends the native scrollable container with these additional props:
| Prop | Type | Default | Description |
|---|---|---|---|
autoHide | boolean | false | Hides the scrollbar when not scrolling |
autoHideDuration | number | 200 | Time in ms before the scrollbar fades out |
style | CSSProperties | — | Inline styles; set height to constrain the scroll area |
className | string | — | Custom CSS class |
children | ReactNode | required | Content to scroll |
Applying height constraints
JumboScrollbar needs an explicit height to activate scrolling. In the sidebar context this is
handled by the parent JumboLayout calculating the available viewport height. For standalone
usage, pass a height directly:
<JumboScrollbar style={{ height: 400 }}>
<LongList items={items} />
</JumboScrollbar>Or use a flex parent that fills available space:
<div style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
<Header />
<JumboScrollbar style={{ flex: 1 }}>
<Content />
</JumboScrollbar>
</div>The scrollbar track and thumb colors are derived from the active MUI theme's palette, so they automatically adapt to dark mode and theme switches without any extra configuration.