feature-grid
What a product does, as a grid of short features: an icon or emoji, a title and a line each. As many columns as fit (min wide each). items is [{ title, text, icon? }].
This one has no events: it shows what it's given.
Source: feature-grid.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/feature-grid.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/feature-grid.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/feature-grid.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/feature-grid.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/feature-grid.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/feature-grid.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/feature-grid.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/feature-grid.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/feature-grid.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/feature-grid.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/feature-grid.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/feature-grid.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/feature-grid.js"></script>The compiled install writes src/components/zubra/feature-grid.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
<feature-grid heading="Everything for your bakery"></feature-grid>
<script type="module">
import './components/zubra/feature-grid.js';
const element = document.querySelector('feature-grid');
element.items = [
{
icon: '🥖',
title: 'Recipes that scale',
text: 'Change the batch size and every amount follows.',
},
{
icon: '⏱',
title: 'Timers per step',
text: 'Proofs and bakes run side by side, with alerts.',
},
{
icon: '🧾',
title: 'Costs per loaf',
text: 'Ingredient prices turn into a price per item.',
},
];
</script>import './components/zubra/feature-grid.js';
const items = [
{
icon: '🥖',
title: 'Recipes that scale',
text: 'Change the batch size and every amount follows.',
},
{
icon: '⏱',
title: 'Timers per step',
text: 'Proofs and bakes run side by side, with alerts.',
},
{
icon: '🧾',
title: 'Costs per loaf',
text: 'Ingredient prices turn into a price per item.',
},
];
export function FeatureGridExample() {
return (
<feature-grid heading="Everything for your bakery" items={items}></feature-grid>
);
}<script setup>
import './components/zubra/feature-grid.js';
const items = [
{
icon: '🥖',
title: 'Recipes that scale',
text: 'Change the batch size and every amount follows.',
},
{
icon: '⏱',
title: 'Timers per step',
text: 'Proofs and bakes run side by side, with alerts.',
},
{
icon: '🧾',
title: 'Costs per loaf',
text: 'Ingredient prices turn into a price per item.',
},
];
</script>
<template>
<feature-grid heading="Everything for your bakery" :items.prop="items"></feature-grid>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/feature-grid.js';
const items = [
{
icon: '🥖',
title: 'Recipes that scale',
text: 'Change the batch size and every amount follows.',
},
{
icon: '⏱',
title: 'Timers per step',
text: 'Proofs and bakes run side by side, with alerts.',
},
{
icon: '🧾',
title: 'Costs per loaf',
text: 'Ingredient prices turn into a price per item.',
},
];
</script>
<feature-grid heading="Everything for your bakery" {items}></feature-grid>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/feature-grid.js';
@Component({
selector: 'app-feature-grid-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<feature-grid heading="Everything for your bakery" [items]="items"></feature-grid>
`,
})
export class FeatureGridExample {
items = [
{
icon: '🥖',
title: 'Recipes that scale',
text: 'Change the batch size and every amount follows.',
},
{
icon: '⏱',
title: 'Timers per step',
text: 'Proofs and bakes run side by side, with alerts.',
},
{
icon: '🧾',
title: 'Costs per loaf',
text: 'Ingredient prices turn into a price per item.',
},
];
}API
| Property | Type | Default |
|---|---|---|
itemsproperty only | { icon, title, text }[] | [] |
heading | string | "" |
min | string | "15rem" |
| Slot | For |
|---|---|
heading | A heading above the grid (defaults to heading, shown only when set). |
Size
0.9 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 17.1 KB.