Zubra UI
Code for
GitHub

cluster-layout

Children in a row that wraps onto more lines when there isn't room: buttons, tags, footer links. justify and align line them up.

Baking Gardening Choir Book club Walking group Quilting

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

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

Install

Compiled (any project)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/cluster-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/cluster-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/cluster-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/cluster-layout.json
One file, no dependencies (2.9 KB gzipped)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/cluster-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/cluster-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/cluster-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/cluster-layout.json
.zb source (to edit it with Zubra)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/cluster-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/cluster-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/cluster-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/cluster-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/cluster-layout.js"></script>

The compiled install writes src/components/zubra/cluster-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
<cluster-layout gap="0.5rem">
  <span class="demo-chip">Baking</span>
  <span class="demo-chip">Gardening</span>
  <span class="demo-chip">Choir</span>
  <span class="demo-chip">Book club</span>
  <span class="demo-chip">Walking group</span>
  <span class="demo-chip">Quilting</span>
</cluster-layout>

<script type="module">
  import './components/zubra/cluster-layout.js';
</script>
Example.jsx
import './components/zubra/cluster-layout.js';

export function ClusterLayoutExample() {
  return (
    <cluster-layout gap="0.5rem">
      <span className="demo-chip">Baking</span>
      <span className="demo-chip">Gardening</span>
      <span className="demo-chip">Choir</span>
      <span className="demo-chip">Book club</span>
      <span className="demo-chip">Walking group</span>
      <span className="demo-chip">Quilting</span>
    </cluster-layout>
  );
}
Example.vue
<script setup>
import './components/zubra/cluster-layout.js';
</script>

<template>
  <cluster-layout gap="0.5rem">
    <span class="demo-chip">Baking</span>
    <span class="demo-chip">Gardening</span>
    <span class="demo-chip">Choir</span>
    <span class="demo-chip">Book club</span>
    <span class="demo-chip">Walking group</span>
    <span class="demo-chip">Quilting</span>
  </cluster-layout>
</template>

<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) -->
Example.svelte
<script>
  import './components/zubra/cluster-layout.js';
</script>

<cluster-layout gap="0.5rem">
  <span class="demo-chip">Baking</span>
  <span class="demo-chip">Gardening</span>
  <span class="demo-chip">Choir</span>
  <span class="demo-chip">Book club</span>
  <span class="demo-chip">Walking group</span>
  <span class="demo-chip">Quilting</span>
</cluster-layout>
example.component.ts
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/cluster-layout.js';

@Component({
  selector: 'app-cluster-layout-example',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <cluster-layout gap="0.5rem">
      <span class="demo-chip">Baking</span>
      <span class="demo-chip">Gardening</span>
      <span class="demo-chip">Choir</span>
      <span class="demo-chip">Book club</span>
      <span class="demo-chip">Walking group</span>
      <span class="demo-chip">Quilting</span>
    </cluster-layout>
  `,
})
export class ClusterLayoutExample {

}

API

Properties (each is also an HTML attribute of the same name, unless marked)
PropertyTypeDefault
gapstring"0.75rem"
justifystring"flex-start"
alignstring"center"
Slots
SlotFor
(default)The children.

Size

0.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 16.6 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