Scroll Area
A scroll container with themed scrollbars and shadows on the edges with more content beyond them.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'both' | vertical | The axes that scroll. |
label | string | — | The accessible name of the scroll region. |
Slots
| Name | Description |
|---|---|
(default) | The content that scrolls. |
Events
| Name | Type | Description |
|---|---|---|
scroll-edge | CustomEvent<{ edge: 'top' | 'bottom' | 'start' | 'end' }> | Fired when a scroll reaches an edge. Does not bubble, so a scroll area nested in another does not trigger the outer one's listener. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
viewport | The element that scrolls. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-scroll-area--max-height | pixel | none | The tallest the area grows before it scrolls. |
--c2-scroll-area--max-width | pixel | none | |
--c2-scroll-area--padding | padding | 0 | |
--c2-scroll-area--border-radius | border-radius | 0 | |
--c2-scroll-area__scrollbar--width | string | thin | thin, auto or none. |
--c2-scroll-area__scrollbar--size | pixel | 8px | The scrollbar's thickness where it can be set (WebKit). |
--c2-scroll-area__thumb--color | color | rgba(113, 113, 122, 0.4) | |
--c2-scroll-area__thumb__hover--color | color | rgba(113, 113, 122, 0.4) | The thumb while the pointer is over the area; with a transparent thumb, the bar fades in on hover. |
--c2-scroll-area__track--color | color | transparent | |
--c2-scroll-area__shadow--color | color | rgba(0, 0, 0, 0.12) | transparent turns the edge shadows off. |
--c2-scroll-area__shadow--size | pixel | 12px | |
--c2-scroll-area__fade--size | pixel | 0px | Above 0, the content fades into each edge with more beyond it. |
--c2-scroll-area__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under scroll-area, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
label | Scrollable content | — |