Skip to content
ui8kit

block / marketing

Feature Grid

Features as cards, tiles or rows with a picture.

Install

npx ui8kit add feature-grid

Pulls in: compose, empty-state, feature-cards, feature-rows, group, kit-box, kit-link, kit-text, link, presets, section-frame, title, utils

Preview

Features of our service

View All

Fast by default

Pages render from static data and ship little script.

Clear structure

One heading per page, landmarks and a skip link come built in.

Safe forms

Inputs carry labels and errors are announced to assistive tools.

Ready for any language

Every text lives in a dictionary, so a new language is one more file.

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are
  Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon),
  media side (rows), density, tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Feature } from "./feature-grid.types";
  import type { HeadLink } from "../components/section-frame.types";

  export type FeatureGridProps = {
    id: string;
    title: string;
    features: Feature[];
    empty?: string;
    action?: HeadLink;
    layout?: "grid" | "rows";
    cols?: "1-2" | "1-3" | "1-4";
    item?: "card" | "tile" | "cell";
    mediaSide?: "end" | "start" | "alternate";
    tone?: "default" | "muted";
    density?: "roomy" | "default" | "compact";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Group from "../compose/Group.svelte";
  import Link from "../compose/Link.svelte";
  import Title from "../compose/Title.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import FeatureCards from "../components/feature-cards.svelte";
  import FeatureRows from "../components/feature-rows.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { defaults } from "../presets/defaults";
  import { cn, urlOf } from "../utils";

  let {
    id,
    title,
    features,
    empty = "",
    action,
    layout = "grid",
    cols = "1-3",
    item = "card",
    mediaSide = "end",
    tone = "default",
    density = "default",
    landmarkLabel,
  }: FeatureGridProps = $props();
</script>

{#if ((item as string) === "cell")}
  <SectionFrame id={id} tone={tone} density={density} measure="fill" class="py-0" landmarkLabel={landmarkLabel}>
    <Group gap="4" align="center" justify="between" class="w-full">
      <Title as={2} size="sm" weight="semibold" class="leading-7" id={(id + "-title")}>
        {title}
      </Title>
      {#if (action?.label && action?.href)}
        <Link
          href={urlOf(action?.href)}
          variant="default"
          class={cn(defaults.text.tiny, "shrink-0 font-medium leading-5")}
          data-slot="section-action"
        >
          {action?.label}
        </Link>
      {/if}
    </Group>
    {#if ((features?.length ?? 0) === 0)}
      <EmptyState icon="layout-grid" title={empty} />
    {:else}
      <FeatureCards features={features} cols={cols} item={item} />
    {/if}
  </SectionFrame>
{:else}
  <SectionFrame id={id} title={title} action={action} tone={tone} density={density} landmarkLabel={landmarkLabel}>
    {#if ((features?.length ?? 0) === 0)}
      <EmptyState icon="layout-grid" title={empty} />
    {:else if ((layout as string) === "rows")}
      <FeatureRows features={features} mediaSide={mediaSide} />
    {:else}
      <FeatureCards features={features} cols={cols} item={item} />
    {/if}
  </SectionFrame>
{/if}
blocks/feature-grid.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Feature = {
  id: string;
  title: string;
  text: string;
  icon: string;
  href?: string;
  image?: string;
};

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are
 * Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon),
 * media side (rows), density, tone.
 */
import { type ReactNode } from "react";
import { Group, Link, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { FeatureCards } from "../components/feature-cards";
import { FeatureRows } from "../components/feature-rows";
import { SectionFrame } from "../components/section-frame";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";
import type { Feature } from "./feature-grid.types";
import type { HeadLink } from "../components/section-frame.types";

export type FeatureGridProps = {
  id: string;
  title: string;
  features: Feature[];
  empty?: string;
  action?: HeadLink;
  layout?: "grid" | "rows";
  cols?: "1-2" | "1-3" | "1-4";
  item?: "card" | "tile" | "cell";
  mediaSide?: "end" | "start" | "alternate";
  tone?: "default" | "muted";
  density?: "roomy" | "default" | "compact";
  landmarkLabel?: string;
};

export function FeatureGrid({
  id,
  title,
  features,
  empty = "",
  action,
  layout = "grid",
  cols = "1-3",
  item = "card",
  mediaSide = "end",
  tone = "default",
  density = "default",
  landmarkLabel,
}: FeatureGridProps) {
  return (
    <>
      {((item as string) === "cell") ? (
        <SectionFrame
          id={id}
          tone={tone}
          density={density}
          measure="fill"
          className="py-0"
          landmarkLabel={landmarkLabel}
        >
          <Group gap="4" align="center" justify="between" className="w-full">
            <Title as={2} size="sm" weight="semibold" className="leading-7" id={(id + "-title")}>
              {title}
            </Title>
            {(action?.label && action?.href) ? (
              <Link
                href={urlOf(action?.href)}
                variant="default"
                className={cn(defaults.text.tiny, "shrink-0 font-medium leading-5")}
                data-slot="section-action"
              >
                {action?.label}
              </Link>
            ) : null}
          </Group>
          {((features?.length ?? 0) === 0) ? (
            <EmptyState icon="layout-grid" title={empty} />
          ) : (
            <FeatureCards features={features} cols={cols} item={item} />
          )}
        </SectionFrame>
      ) : (
        <SectionFrame id={id} title={title} action={action} tone={tone} density={density} landmarkLabel={landmarkLabel}>
          {((features?.length ?? 0) === 0) ? (
            <EmptyState icon="layout-grid" title={empty} />
          ) : ((layout as string) === "rows") ? (
            <FeatureRows features={features} mediaSide={mediaSide} />
          ) : (
            <FeatureCards features={features} cols={cols} item={item} />
          )}
        </SectionFrame>
      )}
    </>
  );
}
blocks/feature-grid.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Feature = {
  id: string;
  title: string;
  text: string;
  icon: string;
  href?: string;
  image?: string;
};

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Feature = {
  id: string;
  title: string;
  text: string;
  icon: string;
  href?: string;
  image?: string;
};
blocks/feature-grid.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are
  Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon),
  media side (rows), density, tone.
-->
<script lang="ts">
import type { Feature } from "./feature-grid.types";
import type { HeadLink } from "../components/section-frame.types";

export type FeatureGridProps = {
  id: string;
  title: string;
  features: Feature[];
  empty?: string;
  action?: HeadLink;
  layout?: "grid" | "rows";
  cols?: "1-2" | "1-3" | "1-4";
  item?: "card" | "tile" | "cell";
  mediaSide?: "end" | "start" | "alternate";
  tone?: "default" | "muted";
  density?: "roomy" | "default" | "compact";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Group from "../compose/Group.vue";
import Link from "../compose/Link.vue";
import Title from "../compose/Title.vue";
import EmptyState from "../components/empty-state.vue";
import FeatureCards from "../components/feature-cards.vue";
import FeatureRows from "../components/feature-rows.vue";
import SectionFrame from "../components/section-frame.vue";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";

const {
  id,
  title,
  features,
  empty = "",
  action,
  layout = "grid",
  cols = "1-3",
  item = "card",
  mediaSide = "end",
  tone = "default",
  density = "default",
  landmarkLabel,
} = defineProps<FeatureGridProps>();
</script>

<template>
  <SectionFrame v-if="((item as string) === 'cell')"
    :id="id"
    :tone="tone"
    :density="density"
    measure="fill"
    class="py-0"
    :landmarkLabel="landmarkLabel"
  >
    <Group gap="4" align="center" justify="between" class="w-full">
      <Title :as="2" size="sm" weight="semibold" class="leading-7" :id="(id + '-title')">
        {{ title }}
      </Title>
      <Link v-if="(action?.label && action?.href)"
        :href="urlOf(action?.href)"
        variant="default"
        :class="cn(defaults.text.tiny, 'shrink-0 font-medium leading-5')"
        data-slot="section-action"
      >
        {{ action?.label }}
      </Link>
    </Group>
    <EmptyState v-if="((features?.length ?? 0) === 0)" icon="layout-grid" :title="empty" />
    <FeatureCards v-else :features="features" :cols="cols" :item="item" />
  </SectionFrame>
  <SectionFrame v-else
    :id="id"
    :title="title"
    :action="action"
    :tone="tone"
    :density="density"
    :landmarkLabel="landmarkLabel"
  >
    <EmptyState v-if="((features?.length ?? 0) === 0)" icon="layout-grid" :title="empty" />
    <FeatureRows v-else-if="((layout as string) === 'rows')" :features="features" :mediaSide="mediaSide" />
    <FeatureCards v-else :features="features" :cols="cols" :item="item" />
  </SectionFrame>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are
 * Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon),
 * media side (rows), density, tone.
 */
import { type JSX } from "solid-js";
import { Group, Link, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { FeatureCards } from "../components/feature-cards";
import { FeatureRows } from "../components/feature-rows";
import { SectionFrame } from "../components/section-frame";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";
import type { Feature } from "./feature-grid.types";
import type { HeadLink } from "../components/section-frame.types";

export type FeatureGridProps = {
  id: string;
  title: string;
  features: Feature[];
  empty?: string;
  action?: HeadLink;
  layout?: "grid" | "rows";
  cols?: "1-2" | "1-3" | "1-4";
  item?: "card" | "tile" | "cell";
  mediaSide?: "end" | "start" | "alternate";
  tone?: "default" | "muted";
  density?: "roomy" | "default" | "compact";
  landmarkLabel?: string;
};

export function FeatureGrid({
  id,
  title,
  features,
  empty = "",
  action,
  layout = "grid",
  cols = "1-3",
  item = "card",
  mediaSide = "end",
  tone = "default",
  density = "default",
  landmarkLabel,
}: FeatureGridProps) {
  return (
    <>
      {((item as string) === "cell") ? (
        <SectionFrame id={id} tone={tone} density={density} measure="fill" class="py-0" landmarkLabel={landmarkLabel}>
          <Group gap="4" align="center" justify="between" class="w-full">
            <Title as={2} size="sm" weight="semibold" class="leading-7" id={(id + "-title")}>
              {title}
            </Title>
            {(action?.label && action?.href) ? (
              <Link
                href={urlOf(action?.href)}
                variant="default"
                class={cn(defaults.text.tiny, "shrink-0 font-medium leading-5")}
                data-slot="section-action"
              >
                {action?.label}
              </Link>
            ) : null}
          </Group>
          {((features?.length ?? 0) === 0) ? (
            <EmptyState icon="layout-grid" title={empty} />
          ) : (
            <FeatureCards features={features} cols={cols} item={item} />
          )}
        </SectionFrame>
      ) : (
        <SectionFrame id={id} title={title} action={action} tone={tone} density={density} landmarkLabel={landmarkLabel}>
          {((features?.length ?? 0) === 0) ? (
            <EmptyState icon="layout-grid" title={empty} />
          ) : ((layout as string) === "rows") ? (
            <FeatureRows features={features} mediaSide={mediaSide} />
          ) : (
            <FeatureCards features={features} cols={cols} item={item} />
          )}
        </SectionFrame>
      )}
    </>
  );
}
blocks/feature-grid.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Feature = {
  id: string;
  title: string;
  text: string;
  icon: string;
  href?: string;
  image?: string;
};

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/feature-grid.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/link"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// FeatureGridProps are the props of FeatureGrid; the values are the JSON shapes of the TypeScript props.
type FeatureGridProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Features any `json:"features"`
	Empty any `json:"empty"`
	Action any `json:"action"`
	Layout any `json:"layout"`
	Cols any `json:"cols"`
	Item any `json:"item"`
	MediaSide any `json:"mediaSide"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon), media side (rows), density, tone.
templ FeatureGrid(p FeatureGridProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vFeatures := p.Features }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vAction := p.Action }}
	{{ vLayout := uiutils.Def(p.Layout, "grid") }}
	{{ vCols := uiutils.Def(p.Cols, "1-3") }}
	{{ vItem := uiutils.Def(p.Item, "card") }}
	{{ vMediaSide := uiutils.Def(p.MediaSide, "end") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	if uiutils.Eq(vItem, "cell") {
		@SectionFrame(SectionFrameProps{Id: vId, Tone: vTone, Density: vDensity, Measure: "fill", Class: uiutils.Cnv("py-0"), LandmarkLabel: vLandmarkLabel}) {
			@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{Class: "w-full"}}) {
				@compose.Title(compose.TitleProps{As: "2", Size: "sm", Weight: "semibold", TextProps: text.TextProps{Class: "leading-7", Attrs: uiutils.Attrs("id", uiutils.Add(vId, "-title"))}}) {
					{ uiutils.Text(vTitle) }
				}
				if uiutils.T(uiutils.And(uiutils.Get(vAction, "label"), uiutils.Get(vAction, "href"))) {
					@compose.Link(compose.LinkProps{Variant: "default", LinkProps: link.LinkProps{Href: uiutils.URL(uiutils.Get(vAction, "href"), false), Class: uiutils.S(uiutils.Cnv(uiutils.Get(presetDefaults, "text", "tiny"), "shrink-0 font-medium leading-5")), Attrs: uiutils.Attrs("data-slot", "section-action")}}) {
						{ uiutils.Text(uiutils.Get(vAction, "label")) }
					}
				}
			}
			if uiutils.Eq(uiutils.Len(vFeatures), float64(0)) {
				@EmptyState(EmptyStateProps{Icon: "layout-grid", Title: vEmpty})
			} else {
				@FeatureCards(FeatureCardsProps{Features: vFeatures, Cols: vCols, Item: vItem})
			}
		}
	} else {
		@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Action: vAction, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
			if uiutils.Eq(uiutils.Len(vFeatures), float64(0)) {
				@EmptyState(EmptyStateProps{Icon: "layout-grid", Title: vEmpty})
			} else if uiutils.Eq(vLayout, "rows") {
				@FeatureRows(FeatureRowsProps{Features: vFeatures, MediaSide: vMediaSide})
			} else {
				@FeatureCards(FeatureCardsProps{Features: vFeatures, Cols: vCols, Item: vItem})
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/feature-grid.json
    A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon), media side (rows), density, tone.
    Props (p): id, title, features, empty, action, layout, cols, item, mediaSide, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_features = (p.features ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_action = (p.action ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set v_cols = (p.cols ?? '1-3') -%}
{%- set v_item = (p.item ?? 'card') -%}
{%- set v_mediaSide = (p.mediaSide ?? 'end') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- if og_t(og_eq(v_item, 'cell')) %}
  {%- set c_4 -%}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(v_title) }}
      {%- endset -%}
      {{ include('compose/Title.html.twig', {'as': 2, 'size': 'sm', 'weight': 'semibold', 'class': 'leading-7', 'attrs': og_attrs(['id', og_add(v_id, '-title')]), 'children': c_1}, with_context = false) }}
      {%- if og_t(og_and([og_get(v_action, ['label']), og_get(v_action, ['href'])])) %}
        {%- set c_2 -%}
          {{ og_text(og_get(v_action, ['label'])) }}
        {%- endset -%}
        {{ include('compose/Link.html.twig', {'href': og_url(og_s(og_get(v_action, ['href']))), 'variant': 'default', 'class': og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['text', 'tiny']), 'shrink-0 font-medium leading-5'])), 'attrs': og_attrs(['data-slot', 'section-action']), 'children': c_2}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'class': 'w-full', 'children': c_3}, with_context = false) }}
    {%- if og_t(og_eq(og_len(v_features), 0)) %}
      {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layout-grid', 'title': v_empty}}, with_context = false) }}
    {%- else %}
      {{ include('blocks/feature-cards.html.twig', {'p': {'features': v_features, 'cols': v_cols, 'item': v_item}}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'tone': v_tone, 'density': v_density, 'measure': 'fill', 'className': og_cnv(['py-0']), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_4)}, with_context = false) }}
{%- else %}
  {%- set c_5 -%}
    {%- if og_t(og_eq(og_len(v_features), 0)) %}
      {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layout-grid', 'title': v_empty}}, with_context = false) }}
    {%- elseif og_t(og_eq(v_layout, 'rows')) %}
      {{ include('blocks/feature-rows.html.twig', {'p': {'features': v_features, 'mediaSide': v_mediaSide}}, with_context = false) }}
    {%- else %}
      {{ include('blocks/feature-cards.html.twig', {'p': {'features': v_features, 'cols': v_cols, 'item': v_item}}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'action': v_action, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_5)}, with_context = false) }}
{%- endif %}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/feature-grid.json
    A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon), media side (rows), density, tone.
    Props (p): id, title, features, empty, action, layout, cols, item, mediaSide, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_features = ($p['features'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_action = ($p['action'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{var $v_cols = ($p['cols'] ?? '1-3')}
{var $v_item = ($p['item'] ?? 'card')}
{var $v_mediaSide = ($p['mediaSide'] ?? 'end')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{if og_t(og_eq($v_item, 'cell'))}
  {capture $c_4}
    {capture $c_3}
      {capture $c_1}
        {=og_text($v_title)}
      {/capture}
      {=og_include('compose/Title.latte', ['as' => 2, 'size' => 'sm', 'weight' => 'semibold', 'class' => 'leading-7', 'attrs' => og_attrs(['id', og_add($v_id, '-title')]), 'children' => (string) $c_1])|noescape}
      {if og_t(og_and([og_get($v_action, ['label']), og_get($v_action, ['href'])]))}
        {capture $c_2}
          {=og_text(og_get($v_action, ['label']))}
        {/capture}
        {=og_include('compose/Link.latte', ['href' => og_url(og_s(og_get($v_action, ['href']))), 'variant' => 'default', 'class' => og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['text', 'tiny']), 'shrink-0 font-medium leading-5'])), 'attrs' => og_attrs(['data-slot', 'section-action']), 'children' => (string) $c_2])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'class' => 'w-full', 'children' => (string) $c_3])|noescape}
    {if og_t(og_eq(og_len($v_features), 0))}
      {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layout-grid', 'title' => $v_empty]])|noescape}
    {else}
      {=og_include('blocks/feature-cards.latte', ['p' => ['features' => $v_features, 'cols' => $v_cols, 'item' => $v_item]])|noescape}
    {/if}
  {/capture}
  {=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'tone' => $v_tone, 'density' => $v_density, 'measure' => 'fill', 'className' => og_cnv(['py-0']), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_4)])|noescape}
{else}
  {capture $c_5}
    {if og_t(og_eq(og_len($v_features), 0))}
      {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layout-grid', 'title' => $v_empty]])|noescape}
    {elseif og_t(og_eq($v_layout, 'rows'))}
      {=og_include('blocks/feature-rows.latte', ['p' => ['features' => $v_features, 'mediaSide' => $v_mediaSide]])|noescape}
    {else}
      {=og_include('blocks/feature-cards.latte', ['p' => ['features' => $v_features, 'cols' => $v_cols, 'item' => $v_item]])|noescape}
    {/if}
  {/capture}
  {=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'action' => $v_action, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_5)])|noescape}
{/if}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add feature-grid
blocks/feature-grid.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/feature-grid.json
    A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon), media side (rows), density, tone.
    Props (p): id, title, features, empty, action, layout, cols, item, mediaSide, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_action = og_def(p['action'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set v_cols = og_def(p['cols'], '1-3') -%}
{%- set v_item = og_def(p['item'], 'card') -%}
{%- set v_mediaSide = og_def(p['mediaSide'], 'end') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- if og_t(og_eq(v_item, 'cell')) %}
  {%- set c_4 -%}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(v_title) }}
      {%- endset -%}
      {{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': 'sm', 'Weight': 'semibold', 'Class': 'leading-7', 'Attrs': og_attrs(['id', og_add(v_id, '-title')])}, 'children': c_1}) }}
      {%- if og_t(og_and([og_get(v_action, ['label']), og_get(v_action, ['href'])])) %}
        {%- set c_2 -%}
          {{ og_text(og_get(v_action, ['label'])) }}
        {%- endset -%}
        {{ og_include('compose/link.html.j2', {'p': {'Href': og_url(og_s(og_get(v_action, ['href']))), 'Variant': 'default', 'Class': og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['text', 'tiny']), 'shrink-0 font-medium leading-5'])), 'Attrs': og_attrs(['data-slot', 'section-action'])}, 'children': c_2}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between', 'Class': 'w-full'}, 'children': c_3}) }}
    {%- if og_t(og_eq(og_len(v_features), 0)) %}
      {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layout-grid', 'title': v_empty}}) }}
    {%- else %}
      {{ og_include('blocks/feature-cards.html.j2', {'p': {'features': v_features, 'cols': v_cols, 'item': v_item}}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'tone': v_tone, 'density': v_density, 'measure': 'fill', 'className': og_cnv(['py-0']), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_4)}) }}
{%- else %}
  {%- set c_5 -%}
    {%- if og_t(og_eq(og_len(v_features), 0)) %}
      {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layout-grid', 'title': v_empty}}) }}
    {%- elif og_t(og_eq(v_layout, 'rows')) %}
      {{ og_include('blocks/feature-rows.html.j2', {'p': {'features': v_features, 'mediaSide': v_mediaSide}}) }}
    {%- else %}
      {{ og_include('blocks/feature-cards.html.j2', {'p': {'features': v_features, 'cols': v_cols, 'item': v_item}}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'action': v_action, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_5)}) }}
{%- endif %}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

A section with a heading and the features as a grid of cards or tiles, or as rows with a picture. Icons are Lucide names. Axes: layout (grid, rows), columns, item (card, tile, cell: bordered tile with a round icon), media side (rows), density, tone.

Props of FeatureGrid
PropTypeDefault Description
id (required)string-
title (required)string-
features (required)Feature[]-
empty string""the text of the empty state (no records), from the dictionary
action HeadLink-optional link opposite the heading
layout "grid" | "rows""grid"
cols "1-2" | "1-3" | "1-4""1-3"columns of the grid layout (responsive)
item "card" | "tile" | "cell""card"card: icon, title and text stacked; tile: compact icon beside title and text; cell: bordered cell with a round icon
mediaSide "end" | "start" | "alternate""end"rows layout: side of the picture; alternate swaps it every row
tone "default" | "muted""default"
density "roomy" | "default" | "compact""default"
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one

Used in