stack-layout
Children one above the other with the same gap between them: the vertical rhythm of a page, a form or a card.
This one has no events: it shows what it's given.
Source: stack-layout.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/stack-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/stack-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/stack-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/stack-layout.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/stack-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/stack-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/stack-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/stack-layout.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/stack-layout.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/stack-layout.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/stack-layout.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/stack-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/stack-layout.js"></script>The compiled install writes src/components/zubra/stack-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
<stack-layout gap="0.75rem">
<div class="demo-box">Your name</div>
<div class="demo-box">Email address</div>
<div class="demo-box">Message</div>
</stack-layout>
<script type="module">
import './components/zubra/stack-layout.js';
</script>import './components/zubra/stack-layout.js';
export function StackLayoutExample() {
return (
<stack-layout gap="0.75rem">
<div className="demo-box">Your name</div>
<div className="demo-box">Email address</div>
<div className="demo-box">Message</div>
</stack-layout>
);
}<script setup>
import './components/zubra/stack-layout.js';
</script>
<template>
<stack-layout gap="0.75rem">
<div class="demo-box">Your name</div>
<div class="demo-box">Email address</div>
<div class="demo-box">Message</div>
</stack-layout>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/stack-layout.js';
</script>
<stack-layout gap="0.75rem">
<div class="demo-box">Your name</div>
<div class="demo-box">Email address</div>
<div class="demo-box">Message</div>
</stack-layout>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/stack-layout.js';
@Component({
selector: 'app-stack-layout-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<stack-layout gap="0.75rem">
<div class="demo-box">Your name</div>
<div class="demo-box">Email address</div>
<div class="demo-box">Message</div>
</stack-layout>
`,
})
export class StackLayoutExample {
}API
| Property | Type | Default |
|---|---|---|
gap | string | "1rem" |
| Slot | For |
|---|---|
(default) | The children. |
Size
0.4 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.5 KB.