layout-reel
Horizontal scrolling container with snap points. Perfect for carousels, image galleries, and card sliders.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
data-layout-gap |
none, xs, s, m, l, xl |
m |
Gap between items |
data-layout-item-width |
auto, s, m, l, xl, full |
auto |
Fixed width for items (15rem, 20rem, 25rem, 30rem, or 100%) |
data-layout-padding |
none, s, m, l |
s |
Padding around the reel |
data-layout-scrollbar |
boolean | - | Shows a thin scrollbar |
data-layout-align |
start, center, end, stretch |
stretch |
Vertical alignment of items |
data-scroll-hint |
boolean or start |
- | Fade edges to hint at scrollable overflow. start fades the end edge only. |
Basic Usage
Items scroll horizontally with scroll snap for smooth navigation.
Basic layout-reel usage
<layout-reel data-layout-gap="m" data-layout-item-width="m"> <layout-card>Item 1</layout-card> <layout-card>Item 2</layout-card> <layout-card>Item 3</layout-card> <layout-card>Item 4</layout-card> <layout-card>Item 5</layout-card></layout-reel>
Item Width Variants
The data-layout-item-width attribute sets consistent widths for all items.
Item width variants
<!-- Small items (15rem) --><layout-reel data-layout-gap="s" data-layout-item-width="s">...</layout-reel> <!-- Medium items (20rem) --><layout-reel data-layout-gap="m" data-layout-item-width="m">...</layout-reel> <!-- Large items (25rem) --><layout-reel data-layout-gap="m" data-layout-item-width="l">...</layout-reel> <!-- Full-width (one at a time carousel) --><layout-reel data-layout-gap="m" data-layout-item-width="full">...</layout-reel>
Scroll Hints
Add data-scroll-hint to fade the edges of the reel, signaling there is more content to scroll. Use data-scroll-hint="start" to only fade the end edge (useful when content starts fully visible). The fade size can be customized with --scroll-hint-size.
Scroll hints
<!-- Both edges fade --><layout-reel data-scroll-hint>...</layout-reel> <!-- End edge only (content starts visible) --><layout-reel data-scroll-hint="start">...</layout-reel> <!-- Custom fade size --><layout-reel data-scroll-hint style="--scroll-hint-size: 3rem;">...</layout-reel>
Scrollbar Visibility
By default the scrollbar is hidden. Add data-layout-scrollbar to show it.
Reel with visible scrollbar
<layout-reel data-layout-gap="m" data-layout-item-width="m" data-layout-scrollbar> <!-- Items --></layout-reel>
Gap Variants
The data-layout-gap attribute controls spacing between items.
Usage Examples
Image Gallery
Image gallery with reel
<layout-reel data-layout-gap="m" data-layout-item-width="m" data-layout-scrollbar> <div data-media data-layout-ratio="4:3" data-radius="m" style="inline-size: 20rem;"> <img src="image1.jpg" alt="Gallery 1" loading="lazy" /> </div> <div data-media data-layout-ratio="4:3" data-radius="m" style="inline-size: 20rem;"> <img src="image2.jpg" alt="Gallery 2" loading="lazy" /> </div> <!-- More images... --></layout-reel>
Product Carousel
Product carousel
<layout-reel data-layout-gap="m" data-layout-item-width="m"> <layout-card data-variant="outlined"> <layout-stack data-layout-gap="s"> <div data-media data-layout-ratio="1:1" data-radius="s"> <img src="product.jpg" alt="Product" loading="lazy" /> </div> <strong>Product Name</strong> <span>$29.99</span> </layout-stack> </layout-card> <!-- More products... --></layout-reel>
Testimonials
Testimonials carousel
<layout-reel data-layout-gap="l" data-layout-item-width="l"> <layout-card data-variant="elevated" data-padding="l"> <layout-stack data-layout-gap="m"> <p style="font-style: italic;">"Great product!"</p> <layout-cluster data-layout-gap="s"> <user-avatar> <img src="avatar.jpg" alt="Avatar" /> </user-avatar> <layout-stack data-layout-gap="xs"> <strong>Jane Smith</strong> <small>CEO, TechCorp</small> </layout-stack> </layout-cluster> </layout-stack> </layout-card> <!-- More testimonials... --></layout-reel>
Team Members
Accessibility
The reel component respects prefers-reduced-motion by disabling scroll snap for users who prefer reduced motion.
Reduced motion accessibility styles
@media (prefers-reduced-motion: reduce) { layout-reel { scroll-snap-type: none; }}
Related
<layout-grid>— Auto-fit grid layout<layout-cluster>— Horizontal grouping with wrapping<layout-card>— Card container