@3mo/scroller
v0.5.1
Published
A web component for scrollable content with thin, themeable scrollbars and optional scroll snapping.
Readme
Scroller
A web component for scrollable content with thin, themeable scrollbars and optional scroll snapping.
A scroll container with a thin, themable scrollbar.
Installation
npm install @3mo/scrollerimport '@3mo/scroller'Usage
<mo-scroller style='height: 400px'>
${Array.from({ length: 50 }, (_, index) => html`<p>Paragraph ${index + 1}</p>`)}
</mo-scroller>Examples
- Horizontal — Content wider than the scroller scrolls sideways with the same thin scrollbar.
- Snapping —
snapTypesetsscroll-snap-type, so that scrolling comes to rest on the items that declarescroll-snap-align. - Custom Properties —
--mo-scroller-thumb-colorand--mo-scroller-track-colorcolor the scrollbar.
API
mo-scroller
Properties
| Name | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| snapType | snapType | ScrollSnapType \| undefined | | The scroll snap type, mapped to scroll-snap-type |
Events
| Name | Detail |
| --- | --- |
| scroll | |
Slots
| Name | Description | | --- | --- | | (default) | The content of the scroller |
CSS custom properties
| Name | Description |
| --- | --- |
| --mo-scroller-thumb-color | The color of the scroller thumb |
| --mo-scroller-track-color | The color of the scroller track |
Links
License
MIT © 3MO GmbH
