EdgeFadeMask
Add edge fade with `mask-image` to avoid hard clipping in scroll containers.
EdgeFadeMask
Add edge fade with mask-image to avoid hard clipping in scroll containers.
Basic Usage (Vertical)
Vertical fade
Demo will load when visible.
Horizontal Scrolling
Horizontal fade
Demo will load when visible.
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
as | string | 'div' | Root tag |
axis | 'vertical' | 'horizontal' | 'vertical' | Fade direction |
size | string | number | 24 | One-side fade distance |
threshold | number | 1 | Scroll-edge threshold in px |
disabled | boolean | false | Disable fade effect |
observeResize | boolean | true | Recompute when container size changes |
Tips
- Keep border/radius styles on the wrapper;
TxEdgeFadeMaskhandles scroll and mask. - For horizontal mode, prefer inner content with
display: flexandwidth: max-content.
Interaction Contract
ascontrols the root element tag. Default slot content is rendered inside the internal viewport.- No
mask-imageis emitted when content is not scrollable,disabled=true, or the scroll range is less than or equal tothreshold. - Vertical mode switches top/bottom fades from
scrollTop; horizontal mode switches left/right fades fromscrollLeft. - Numeric
sizevalues are converted to px. Stringsizevalues are used as-is in gradient stops. - With
observeResize=true, the component observes the viewport and first child. It disconnects the observer when disabled by prop or unmounted.