Skip to content
ui8kit

block / marketing

Feature Split

Features beside a picture: plain in two columns, as cards with actions, two figures over checked rows, or four metric cards with actions.

Install

npx ui8kit add feature-split

Pulls in: action-group, error-page, feature-cards, feature-grid, feature-metric-cards, feature-pairs, feature-stat-rows, media-frame, section-frame, stats-band, utils

Preview

Features

Built for teams that ship

Everything you need to plan, build and publish, in one place.

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-split
blocks/feature-split.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. -->
<!--
  Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as
  cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four
  metric cards and the actions), mediaSide, tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Feature } from "./feature-grid.types";
  import type { Stat } from "./stats-band.types";
  import type { LinkActions } from "./error-page.types";

  export type FeatureSplitProps = {
    id: string;
    title: string;
    lead?: string;
    badge?: string;
    level?: 1 | 2;
    features: Feature[];
    stats: Stat[];
    actions: LinkActions;
    layout?: "grid" | "cards" | "stats" | "metrics";
    mediaSide?: "end" | "start";
    tone?: "default" | "muted";
    image?: string;
    imageAlt?: string;
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import ActionGroup from "../components/action-group.svelte";
  import FeatureCards from "../components/feature-cards.svelte";
  import FeatureMetricCards from "../components/feature-metric-cards.svelte";
  import FeaturePairs from "../components/feature-pairs.svelte";
  import FeatureStatRows from "../components/feature-stat-rows.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";

  let {
    id,
    title,
    lead = "",
    badge = "",
    level = 2,
    features,
    stats,
    actions,
    layout = "grid",
    mediaSide = "end",
    tone = "default",
    image,
    imageAlt,
    landmarkLabel,
  }: FeatureSplitProps = $props();
</script>

<SectionFrame
  id={id}
  title={title}
  lead={lead}
  heading={{ badge, level }}
  tone={tone}
  layout="split"
  media={{ show: true, side: mediaSide }}
  landmarkLabel={landmarkLabel}
>
  {#if ((layout as string) === "grid")}
    {#if ((features?.length ?? 0) > 0)}
      <FeaturePairs features={features} />
    {/if}
  {/if}
  {#if ((layout as string) === "cards")}
    {#if ((features?.length ?? 0) > 0)}
      <FeatureCards features={features} cols="1-2" item="tile" />
    {/if}
  {/if}
  {#if ((layout as string) === "stats")}
    {#if ((features?.length ?? 0) > 0)}
      <FeatureStatRows features={features} stats={stats} />
    {/if}
  {/if}
  {#if ((layout as string) === "metrics")}
    {#if ((stats?.length ?? 0) > 0)}
      <FeatureMetricCards stats={stats} />
    {/if}
  {/if}
  {#if (((layout as string) === "cards") || ((layout as string) === "metrics"))}
    <ActionGroup
      primary={actions.cta}
      primaryHref={actions.href}
      secondary={((actions.mode === "two") ? actions.secondary : undefined)}
      secondaryHref={actions.secondaryHref}
    />
  {/if}
  {#snippet aside()}
    <MediaFrame
      alt={(imageAlt ? imageAlt : title)}
      src={image}
      ratio={(((layout as string) === "stats") ? "1/1" : "4/3")}
    />
  {/snippet}
</SectionFrame>

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-split
blocks/feature-split.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.
/**
 * Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as
 * cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four
 * metric cards and the actions), mediaSide, tone.
 */
import { type ReactNode } from "react";
import { ActionGroup } from "../components/action-group";
import { FeatureCards } from "../components/feature-cards";
import { FeatureMetricCards } from "../components/feature-metric-cards";
import { FeaturePairs } from "../components/feature-pairs";
import { FeatureStatRows } from "../components/feature-stat-rows";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import type { Feature } from "./feature-grid.types";
import type { Stat } from "./stats-band.types";
import type { LinkActions } from "./error-page.types";

export type FeatureSplitProps = {
  id: string;
  title: string;
  lead?: string;
  badge?: string;
  level?: 1 | 2;
  features: Feature[];
  stats: Stat[];
  actions: LinkActions;
  layout?: "grid" | "cards" | "stats" | "metrics";
  mediaSide?: "end" | "start";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function FeatureSplit({
  id,
  title,
  lead = "",
  badge = "",
  level = 2,
  features,
  stats,
  actions,
  layout = "grid",
  mediaSide = "end",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
}: FeatureSplitProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={lead}
      heading={{ badge, level }}
      tone={tone}
      layout="split"
      media={{ show: true, side: mediaSide }}
      landmarkLabel={landmarkLabel}
      aside={(
        <MediaFrame
          alt={(imageAlt ? imageAlt : title)}
          src={image}
          ratio={(((layout as string) === "stats") ? "1/1" : "4/3")}
        />
      )}
    >
      {((layout as string) === "grid") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeaturePairs features={features} />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "cards") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeatureCards features={features} cols="1-2" item="tile" />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "stats") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeatureStatRows features={features} stats={stats} />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "metrics") ? (
        <>
          {((stats?.length ?? 0) > 0) ? (
            <FeatureMetricCards stats={stats} />
          ) : null}
        </>
      ) : null}
      {(((layout as string) === "cards") || ((layout as string) === "metrics")) ? (
        <ActionGroup
          primary={actions.cta}
          primaryHref={actions.href}
          secondary={((actions.mode === "two") ? actions.secondary : undefined)}
          secondaryHref={actions.secondaryHref}
        />
      ) : null}
    </SectionFrame>
  );
}

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-split
blocks/feature-split.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. -->
<!--
  Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as
  cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four
  metric cards and the actions), mediaSide, tone.
-->
<script lang="ts">
import type { Feature } from "./feature-grid.types";
import type { Stat } from "./stats-band.types";
import type { LinkActions } from "./error-page.types";

export type FeatureSplitProps = {
  id: string;
  title: string;
  lead?: string;
  badge?: string;
  level?: 1 | 2;
  features: Feature[];
  stats: Stat[];
  actions: LinkActions;
  layout?: "grid" | "cards" | "stats" | "metrics";
  mediaSide?: "end" | "start";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import ActionGroup from "../components/action-group.vue";
import FeatureCards from "../components/feature-cards.vue";
import FeatureMetricCards from "../components/feature-metric-cards.vue";
import FeaturePairs from "../components/feature-pairs.vue";
import FeatureStatRows from "../components/feature-stat-rows.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";

const {
  id,
  title,
  lead = "",
  badge = "",
  level = 2,
  features,
  stats,
  actions,
  layout = "grid",
  mediaSide = "end",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
} = defineProps<FeatureSplitProps>();
</script>

<template>
  <SectionFrame
    :id="id"
    :title="title"
    :lead="lead"
    :heading="{ badge, level }"
    :tone="tone"
    layout="split"
    :media="{ show: true, side: mediaSide }"
    :landmarkLabel="landmarkLabel"
  >
    <template v-if="((layout as string) === 'grid')">
      <FeaturePairs v-if="((features?.length ?? 0) > 0)" :features="features" />
    </template>
    <template v-if="((layout as string) === 'cards')">
      <FeatureCards v-if="((features?.length ?? 0) > 0)" :features="features" cols="1-2" item="tile" />
    </template>
    <template v-if="((layout as string) === 'stats')">
      <FeatureStatRows v-if="((features?.length ?? 0) > 0)" :features="features" :stats="stats" />
    </template>
    <template v-if="((layout as string) === 'metrics')">
      <FeatureMetricCards v-if="((stats?.length ?? 0) > 0)" :stats="stats" />
    </template>
    <ActionGroup v-if="(((layout as string) === 'cards') || ((layout as string) === 'metrics'))"
      :primary="actions.cta"
      :primaryHref="actions.href"
      :secondary="((actions.mode === 'two') ? actions.secondary : undefined)"
      :secondaryHref="actions.secondaryHref"
    />
    <template #aside>
      <MediaFrame
        :alt="(imageAlt ? imageAlt : title)"
        :src="image"
        :ratio="(((layout as string) === 'stats') ? '1/1' : '4/3')"
      />
    </template>
  </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-split
blocks/feature-split.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.
/**
 * Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as
 * cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four
 * metric cards and the actions), mediaSide, tone.
 */
import { type JSX } from "solid-js";
import { ActionGroup } from "../components/action-group";
import { FeatureCards } from "../components/feature-cards";
import { FeatureMetricCards } from "../components/feature-metric-cards";
import { FeaturePairs } from "../components/feature-pairs";
import { FeatureStatRows } from "../components/feature-stat-rows";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import type { Feature } from "./feature-grid.types";
import type { Stat } from "./stats-band.types";
import type { LinkActions } from "./error-page.types";

export type FeatureSplitProps = {
  id: string;
  title: string;
  lead?: string;
  badge?: string;
  level?: 1 | 2;
  features: Feature[];
  stats: Stat[];
  actions: LinkActions;
  layout?: "grid" | "cards" | "stats" | "metrics";
  mediaSide?: "end" | "start";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function FeatureSplit({
  id,
  title,
  lead = "",
  badge = "",
  level = 2,
  features,
  stats,
  actions,
  layout = "grid",
  mediaSide = "end",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
}: FeatureSplitProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={lead}
      heading={{ badge, level }}
      tone={tone}
      layout="split"
      media={{ show: true, side: mediaSide }}
      landmarkLabel={landmarkLabel}
      aside={(
        <MediaFrame
          alt={(imageAlt ? imageAlt : title)}
          src={image}
          ratio={(((layout as string) === "stats") ? "1/1" : "4/3")}
        />
      )}
    >
      {((layout as string) === "grid") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeaturePairs features={features} />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "cards") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeatureCards features={features} cols="1-2" item="tile" />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "stats") ? (
        <>
          {((features?.length ?? 0) > 0) ? (
            <FeatureStatRows features={features} stats={stats} />
          ) : null}
        </>
      ) : null}
      {((layout as string) === "metrics") ? (
        <>
          {((stats?.length ?? 0) > 0) ? (
            <FeatureMetricCards stats={stats} />
          ) : null}
        </>
      ) : null}
      {(((layout as string) === "cards") || ((layout as string) === "metrics")) ? (
        <ActionGroup
          primary={actions.cta}
          primaryHref={actions.href}
          secondary={((actions.mode === "two") ? actions.secondary : undefined)}
          secondaryHref={actions.secondaryHref}
        />
      ) : null}
    </SectionFrame>
  );
}

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-split
blocks/feature-split.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-split.json

package blocks

import (
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// FeatureSplitProps are the props of FeatureSplit; the values are the JSON shapes of the TypeScript props.
type FeatureSplitProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Lead any `json:"lead"`
	Badge any `json:"badge"`
	Level any `json:"level"`
	Features any `json:"features"`
	Stats any `json:"stats"`
	Actions any `json:"actions"`
	Layout any `json:"layout"`
	MediaSide any `json:"mediaSide"`
	Tone any `json:"tone"`
	Image any `json:"image"`
	ImageAlt any `json:"imageAlt"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four metric cards and the actions), mediaSide, tone.
templ FeatureSplit(p FeatureSplitProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vBadge := uiutils.Def(p.Badge, "") }}
	{{ vLevel := uiutils.Def(p.Level, float64(2)) }}
	{{ vFeatures := p.Features }}
	{{ vStats := p.Stats }}
	{{ vActions := p.Actions }}
	{{ vLayout := uiutils.Def(p.Layout, "grid") }}
	{{ vMediaSide := uiutils.Def(p.MediaSide, "end") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vImage := p.Image }}
	{{ vImageAlt := p.ImageAlt }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Heading: map[string]any{"badge": vBadge, "level": vLevel}, Tone: vTone, Layout: "split", Media: map[string]any{"show": true, "side": vMediaSide}, LandmarkLabel: vLandmarkLabel, Aside: featureSplitFill1(p, vTitle, vLayout, vImage, vImageAlt)}) {
		if uiutils.Eq(vLayout, "grid") {
			if uiutils.Gt(uiutils.Len(vFeatures), float64(0)) {
				@FeaturePairs(FeaturePairsProps{Features: vFeatures})
			}
		}
		if uiutils.Eq(vLayout, "cards") {
			if uiutils.Gt(uiutils.Len(vFeatures), float64(0)) {
				@FeatureCards(FeatureCardsProps{Features: vFeatures, Cols: "1-2", Item: "tile"})
			}
		}
		if uiutils.Eq(vLayout, "stats") {
			if uiutils.Gt(uiutils.Len(vFeatures), float64(0)) {
				@FeatureStatRows(FeatureStatRowsProps{Features: vFeatures, Stats: vStats})
			}
		}
		if uiutils.Eq(vLayout, "metrics") {
			if uiutils.Gt(uiutils.Len(vStats), float64(0)) {
				@FeatureMetricCards(FeatureMetricCardsProps{Stats: vStats})
			}
		}
		if uiutils.T(uiutils.Or(uiutils.Eq(vLayout, "cards"), uiutils.Eq(vLayout, "metrics"))) {
			@ActionGroup(ActionGroupProps{Primary: uiutils.Get(vActions, "cta"), PrimaryHref: uiutils.Get(vActions, "href"), Secondary: uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vActions, "mode"), "two")), uiutils.Get(vActions, "secondary"), nil), SecondaryHref: uiutils.Get(vActions, "secondaryHref")})
		}
	}
}

templ featureSplitFill1(p FeatureSplitProps, vTitle any, vLayout any, vImage any, vImageAlt any) {
	@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stats")), "1/1", "4/3")})
}

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-split
blocks/feature-split.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-split.json
    Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four metric cards and the actions), mediaSide, tone.
    Props (p): id, title, lead, badge, level, features, stats, actions, layout, mediaSide, tone, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_badge = (p.badge ?? '') -%}
{%- set v_level = (p.level ?? 2) -%}
{%- set v_features = (p.features ?? null) -%}
{%- set v_stats = (p.stats ?? null) -%}
{%- set v_actions = (p.actions ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set v_mediaSide = (p.mediaSide ?? 'end') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set f_1 -%}
  {{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image, 'ratio': (og_t(og_eq(v_layout, 'stats')) ? '1/1' : '4/3')}}, with_context = false) }}
{%- endset -%}
{%- set c_2 -%}
  {%- if og_t(og_eq(v_layout, 'grid')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ include('blocks/feature-pairs.html.twig', {'p': {'features': v_features}}, with_context = false) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'cards')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ include('blocks/feature-cards.html.twig', {'p': {'features': v_features, 'cols': '1-2', 'item': 'tile'}}, with_context = false) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'stats')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ include('blocks/feature-stat-rows.html.twig', {'p': {'features': v_features, 'stats': v_stats}}, with_context = false) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'metrics')) %}
    {%- if og_t(og_gt(og_len(v_stats), 0)) %}
      {{ include('blocks/feature-metric-cards.html.twig', {'p': {'stats': v_stats}}, with_context = false) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_or([og_eq(v_layout, 'cards'), og_eq(v_layout, 'metrics')])) %}
    {{ include('blocks/action-group.html.twig', {'p': {'primary': og_get(v_actions, ['cta']), 'primaryHref': og_get(v_actions, ['href']), 'secondary': (og_t(og_eq(og_get(v_actions, ['mode']), 'two')) ? og_get(v_actions, ['secondary']) : null), 'secondaryHref': og_get(v_actions, ['secondaryHref'])}}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'heading': {'badge': v_badge, 'level': v_level}, 'tone': v_tone, 'layout': 'split', 'media': {'show': true, 'side': v_mediaSide}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_1)}, 'children': og_markup(c_2)}, with_context = false) }}

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-split
blocks/feature-split.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-split.json
    Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four metric cards and the actions), mediaSide, tone.
    Props (p): id, title, lead, badge, level, features, stats, actions, layout, mediaSide, tone, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_badge = ($p['badge'] ?? '')}
{var $v_level = ($p['level'] ?? 2)}
{var $v_features = ($p['features'] ?? null)}
{var $v_stats = ($p['stats'] ?? null)}
{var $v_actions = ($p['actions'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{var $v_mediaSide = ($p['mediaSide'] ?? 'end')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $f_1}
  {=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => (og_t(og_eq($v_layout, 'stats')) ? '1/1' : '4/3')]])|noescape}
{/capture}
{capture $c_2}
  {if og_t(og_eq($v_layout, 'grid'))}
    {if og_t(og_gt(og_len($v_features), 0))}
      {=og_include('blocks/feature-pairs.latte', ['p' => ['features' => $v_features]])|noescape}
    {/if}
  {/if}
  {if og_t(og_eq($v_layout, 'cards'))}
    {if og_t(og_gt(og_len($v_features), 0))}
      {=og_include('blocks/feature-cards.latte', ['p' => ['features' => $v_features, 'cols' => '1-2', 'item' => 'tile']])|noescape}
    {/if}
  {/if}
  {if og_t(og_eq($v_layout, 'stats'))}
    {if og_t(og_gt(og_len($v_features), 0))}
      {=og_include('blocks/feature-stat-rows.latte', ['p' => ['features' => $v_features, 'stats' => $v_stats]])|noescape}
    {/if}
  {/if}
  {if og_t(og_eq($v_layout, 'metrics'))}
    {if og_t(og_gt(og_len($v_stats), 0))}
      {=og_include('blocks/feature-metric-cards.latte', ['p' => ['stats' => $v_stats]])|noescape}
    {/if}
  {/if}
  {if og_t(og_or([og_eq($v_layout, 'cards'), og_eq($v_layout, 'metrics')]))}
    {=og_include('blocks/action-group.latte', ['p' => ['primary' => og_get($v_actions, ['cta']), 'primaryHref' => og_get($v_actions, ['href']), 'secondary' => (og_t(og_eq(og_get($v_actions, ['mode']), 'two')) ? og_get($v_actions, ['secondary']) : null), 'secondaryHref' => og_get($v_actions, ['secondaryHref'])]])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'heading' => ['badge' => $v_badge, 'level' => $v_level], 'tone' => $v_tone, 'layout' => 'split', 'media' => ['show' => true, 'side' => $v_mediaSide], 'landmarkLabel' => $v_landmarkLabel, 'aside' => og_markup($f_1)], 'children' => og_markup($c_2)])|noescape}

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-split
blocks/feature-split.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-split.json
    Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four metric cards and the actions), mediaSide, tone.
    Props (p): id, title, lead, badge, level, features, stats, actions, layout, mediaSide, tone, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_badge = og_def(p['badge'], '') -%}
{%- set v_level = og_def(p['level'], 2) -%}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_stats = og_def(p['stats'], none) -%}
{%- set v_actions = og_def(p['actions'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set v_mediaSide = og_def(p['mediaSide'], 'end') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_imageAlt = og_def(p['imageAlt'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set f_1 -%}
  {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'src': v_image, 'ratio': ('1/1' if og_t(og_eq(v_layout, 'stats')) else '4/3')}}) }}
{%- endset -%}
{%- set c_2 -%}
  {%- if og_t(og_eq(v_layout, 'grid')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ og_include('blocks/feature-pairs.html.j2', {'p': {'features': v_features}}) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'cards')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ og_include('blocks/feature-cards.html.j2', {'p': {'features': v_features, 'cols': '1-2', 'item': 'tile'}}) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'stats')) %}
    {%- if og_t(og_gt(og_len(v_features), 0)) %}
      {{ og_include('blocks/feature-stat-rows.html.j2', {'p': {'features': v_features, 'stats': v_stats}}) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_eq(v_layout, 'metrics')) %}
    {%- if og_t(og_gt(og_len(v_stats), 0)) %}
      {{ og_include('blocks/feature-metric-cards.html.j2', {'p': {'stats': v_stats}}) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_or([og_eq(v_layout, 'cards'), og_eq(v_layout, 'metrics')])) %}
    {{ og_include('blocks/action-group.html.j2', {'p': {'primary': og_get(v_actions, ['cta']), 'primaryHref': og_get(v_actions, ['href']), 'secondary': (og_get(v_actions, ['secondary']) if og_t(og_eq(og_get(v_actions, ['mode']), 'two')) else none), 'secondaryHref': og_get(v_actions, ['secondaryHref'])}}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'heading': {'badge': v_badge, 'level': v_level}, 'tone': v_tone, 'layout': 'split', 'media': {'show': true, 'side': v_mediaSide}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_1)}, 'children': og_markup(c_2)}) }}

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.

Features beside a picture. Axes: layout (grid: four plain features in two columns, cards: four features as cards and the actions, stats: two figure cards over three checked rows beside a square picture, metrics: four metric cards and the actions), mediaSide, tone.

Props of FeatureSplit
PropTypeDefault Description
id (required)string-
title (required)string-
lead string""
badge string""a short pill above the heading
level 1 | 22
features (required)Feature[]-
stats (required)Stat[]-
actions (required)LinkActions-shown in the cards and metrics layouts
layout "grid" | "cards" | "stats" | "metrics""grid"
mediaSide "end" | "start""end"
tone "default" | "muted""default"
image string-address of the picture (an https URL or a path); none: the placeholder
imageAlt string-alt text of the picture; none: the title
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