reel-layout
A row that scrolls sideways: cards, photos, episodes. Each child is item wide and snaps into place. The row is a labelled region that takes focus, so arrow keys scroll it; controls adds previous and next buttons that move one item at a time, and are disabled at either end.
This one has no events: it shows what it's given.
Source: reel-layout.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/reel-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/reel-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/reel-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/reel-layout.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/reel-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/reel-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/reel-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/reel-layout.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/reel-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/reel-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/reel-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/reel-layout.json
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/reel-layout.js"></script>The compiled install writes src/components/zubra/reel-layout.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.
Usage
<reel-layout item="11rem" gap="0.75rem" label="Upcoming events">
<div class="demo-box">Bake sale</div>
<div class="demo-box">Choir night</div>
<div class="demo-box">Plant swap</div>
<div class="demo-box">Book club</div>
<div class="demo-box">Quiz night</div>
<div class="demo-box">Litter pick</div>
</reel-layout>
<script type="module">
import './components/zubra/reel-layout.js';
const element = document.querySelector('reel-layout');
element.controls = true;
</script>import './components/zubra/reel-layout.js';
const controls = true;
export function ReelLayoutExample() {
return (
<reel-layout
item="11rem"
gap="0.75rem"
label="Upcoming events"
controls={controls}
>
<div className="demo-box">Bake sale</div>
<div className="demo-box">Choir night</div>
<div className="demo-box">Plant swap</div>
<div className="demo-box">Book club</div>
<div className="demo-box">Quiz night</div>
<div className="demo-box">Litter pick</div>
</reel-layout>
);
}<script setup>
import './components/zubra/reel-layout.js';
const controls = true;
</script>
<template>
<reel-layout
item="11rem"
gap="0.75rem"
label="Upcoming events"
:controls.prop="controls"
>
<div class="demo-box">Bake sale</div>
<div class="demo-box">Choir night</div>
<div class="demo-box">Plant swap</div>
<div class="demo-box">Book club</div>
<div class="demo-box">Quiz night</div>
<div class="demo-box">Litter pick</div>
</reel-layout>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/reel-layout.js';
const controls = true;
</script>
<reel-layout item="11rem" gap="0.75rem" label="Upcoming events" {controls}>
<div class="demo-box">Bake sale</div>
<div class="demo-box">Choir night</div>
<div class="demo-box">Plant swap</div>
<div class="demo-box">Book club</div>
<div class="demo-box">Quiz night</div>
<div class="demo-box">Litter pick</div>
</reel-layout>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/reel-layout.js';
@Component({
selector: 'app-reel-layout-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<reel-layout
item="11rem"
gap="0.75rem"
label="Upcoming events"
[controls]="controls"
>
<div class="demo-box">Bake sale</div>
<div class="demo-box">Choir night</div>
<div class="demo-box">Plant swap</div>
<div class="demo-box">Book club</div>
<div class="demo-box">Quiz night</div>
<div class="demo-box">Litter pick</div>
</reel-layout>
`,
})
export class ReelLayoutExample {
controls = true;
}API
| Property | Type | Default |
|---|---|---|
item | string | "16rem" |
gap | string | "1rem" |
label | string | "Items" |
controls | boolean | false |
| Slot | For |
|---|---|
(default) | The children. |
Size
1.5 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 18.0 KB.