Zubra UI
Code for
GitHub

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.

Bake sale
Choir night
Plant swap
Book club
Quiz night
Litter pick

This one has no events: it shows what it's given.

Source: reel-layout.zb, and its registry item.

Install

Compiled (any project)
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
One file, no dependencies (4.4 KB gzipped)
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
.zb source (to edit it with Zubra)
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
No build: a script tag, straight from this site
HTML
<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

index.html
<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>
Example.jsx
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>
  );
}
Example.vue
<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('-') } } }) -->
Example.svelte
<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>
example.component.ts
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

Properties (each is also an HTML attribute of the same name, unless marked)
PropertyTypeDefault
itemstring"16rem"
gapstring"1rem"
labelstring"Items"
controlsbooleanfalse
Slots
SlotFor
(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.

Theme

Every component reads shadcn/ui's CSS variables, so any shadcn theme works. Pick a look or a colour, or paste a theme's CSS.

Look: colours, fonts, corners and motion

Accent colour