Hero Split Media
Hero Split Media component
Install
npx ui8kit add hero-split-mediaPulls in: box, compose, figure-block, group, hero-split, kit-box, kit-text, lucide-icon, media-frame, offer-media, stack, text, utils
Preview
Solo
One person, one site
Team
For a small team
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-cdnnpx ui8kit add hero-split-media<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with
captions, or a picture with two plan cards floating over it.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { HeroContent } from "../blocks/hero-split.types";
export type HeroSplitMediaProps = {
content: HeroContent;
alt: string;
image?: string;
media?: "picture" | "card" | "grid" | "plans";
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import FigureBlock from "../components/figure-block.svelte";
import MediaFrame from "../components/media-frame.svelte";
import OfferMedia from "../components/offer-media.svelte";
import { cn } from "../utils";
let { content, alt, image, media = "picture" }: HeroSplitMediaProps = $props();
</script>
{#if ((media as string) === "picture")}
<MediaFrame alt={alt} src={image} ratio="4/3" />
{/if}
{#if ((media as string) === "card")}
<OfferMedia alt={alt} image={image} card={content.card} />
{/if}
{#if (((media as string) === "grid") && ((content.features?.length ?? 0) > 0))}
<Box class="grid grid-cols-2 gap-4" data-slot="hero-grid">
{#each content.features as f, i (f.id)}
{#if (i < 4)}
<FigureBlock class="flex flex-col gap-2" testid="hero-tile">
<MediaFrame alt={f.title} src={f.image} ratio="1/1" />
<Text size="xs" class="text-muted-foreground">
{f.title}
</Text>
</FigureBlock>
{/if}
{/each}
</Box>
{/if}
{#if (((media as string) === "plans") && ((content.plans?.length ?? 0) > 0))}
<Box class="relative" data-slot="hero-media">
<MediaFrame alt={alt} src={image} ratio="4/3" />
{#each content.plans as p, i (p.id)}
{#if (i < 2)}
<Stack
gap="2"
class={cn(
"absolute w-48 rounded bg-card p-4 shadow-lg",
((i === 0) ? "top-8 left-4" : "right-4 bottom-8")
)}
data-slot="hero-plan"
>
<Text size="sm" weight="semibold">
{p.name}
</Text>
<Group gap="2" align="center">
<LucideIcon name="check" size={16} />
<Text size="xs" class="text-muted-foreground">
{p.tagline}
</Text>
</Group>
</Stack>
{/if}
{/each}
</Box>
{/if}
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-cdnnpx ui8kit add hero-split-media// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with
* captions, or a picture with two plan cards floating over it.
*/
import { Fragment, type ReactNode } from "react";
import { Box, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { OfferMedia } from "../components/offer-media";
import { cn } from "../utils";
import type { HeroContent } from "../blocks/hero-split.types";
export type HeroSplitMediaProps = {
content: HeroContent;
alt: string;
image?: string;
media?: "picture" | "card" | "grid" | "plans";
};
export function HeroSplitMedia({ content, alt, image, media = "picture" }: HeroSplitMediaProps) {
return (
<>
{((media as string) === "picture") ? (
<MediaFrame alt={alt} src={image} ratio="4/3" />
) : null}
{((media as string) === "card") ? (
<OfferMedia alt={alt} image={image} card={content.card} />
) : null}
{(((media as string) === "grid") && ((content.features?.length ?? 0) > 0)) ? (
<Box className="grid grid-cols-2 gap-4" data-slot="hero-grid">
{(content.features ?? []).map((f, i) => (
<Fragment key={f.id}>
{(i < 4) ? (
<FigureBlock className="flex flex-col gap-2" testid="hero-tile">
<MediaFrame alt={f.title} src={f.image} ratio="1/1" />
<Text size="xs" className="text-muted-foreground">
{f.title}
</Text>
</FigureBlock>
) : null}
</Fragment>
))}
</Box>
) : null}
{(((media as string) === "plans") && ((content.plans?.length ?? 0) > 0)) ? (
<Box className="relative" data-slot="hero-media">
<MediaFrame alt={alt} src={image} ratio="4/3" />
{(content.plans ?? []).map((p, i) => (
<Fragment key={p.id}>
{(i < 2) ? (
<Stack
gap="2"
className={cn(
"absolute w-48 rounded bg-card p-4 shadow-lg",
((i === 0) ? "top-8 left-4" : "right-4 bottom-8")
)}
data-slot="hero-plan"
>
<Text size="sm" weight="semibold">
{p.name}
</Text>
<Group gap="2" align="center">
<LucideIcon name="check" size={16} />
<Text size="xs" className="text-muted-foreground">
{p.tagline}
</Text>
</Group>
</Stack>
) : null}
</Fragment>
))}
</Box>
) : null}
</>
);
}
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-cdnnpx ui8kit add hero-split-media<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with
captions, or a picture with two plan cards floating over it.
-->
<script lang="ts">
import type { HeroContent } from "../blocks/hero-split.types";
export type HeroSplitMediaProps = {
content: HeroContent;
alt: string;
image?: string;
media?: "picture" | "card" | "grid" | "plans";
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import FigureBlock from "../components/figure-block.vue";
import MediaFrame from "../components/media-frame.vue";
import OfferMedia from "../components/offer-media.vue";
import { cn } from "../utils";
const { content, alt, image, media = "picture" } = defineProps<HeroSplitMediaProps>();
</script>
<template>
<MediaFrame v-if="((media as string) === 'picture')" :alt="alt" :src="image" ratio="4/3" />
<OfferMedia v-if="((media as string) === 'card')" :alt="alt" :image="image" :card="content.card" />
<Box
v-if="(((media as string) === 'grid') && ((content.features?.length ?? 0) > 0))"
class="grid grid-cols-2 gap-4"
data-slot="hero-grid"
>
<template v-for="(f, i) in content.features" :key="f.id">
<FigureBlock v-if="(i < 4)" class="flex flex-col gap-2" testid="hero-tile">
<MediaFrame :alt="f.title" :src="f.image" ratio="1/1" />
<Text size="xs" class="text-muted-foreground">
{{ f.title }}
</Text>
</FigureBlock>
</template>
</Box>
<Box
v-if="(((media as string) === 'plans') && ((content.plans?.length ?? 0) > 0))"
class="relative"
data-slot="hero-media"
>
<MediaFrame :alt="alt" :src="image" ratio="4/3" />
<template v-for="(p, i) in content.plans" :key="p.id">
<Stack v-if="(i < 2)"
gap="2"
:class="cn(
'absolute w-48 rounded bg-card p-4 shadow-lg',
((i === 0) ? 'top-8 left-4' : 'right-4 bottom-8')
)"
data-slot="hero-plan"
>
<Text size="sm" weight="semibold">
{{ p.name }}
</Text>
<Group gap="2" align="center">
<LucideIcon name="check" :size="16" />
<Text size="xs" class="text-muted-foreground">
{{ p.tagline }}
</Text>
</Group>
</Stack>
</template>
</Box>
</template>
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-cdnnpx ui8kit add hero-split-media// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with
* captions, or a picture with two plan cards floating over it.
*/
import { For, type JSX } from "solid-js";
import { Box, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { OfferMedia } from "../components/offer-media";
import { cn } from "../utils";
import type { HeroContent } from "../blocks/hero-split.types";
export type HeroSplitMediaProps = {
content: HeroContent;
alt: string;
image?: string;
media?: "picture" | "card" | "grid" | "plans";
};
export function HeroSplitMedia({ content, alt, image, media = "picture" }: HeroSplitMediaProps) {
return (
<>
{((media as string) === "picture") ? (
<MediaFrame alt={alt} src={image} ratio="4/3" />
) : null}
{((media as string) === "card") ? (
<OfferMedia alt={alt} image={image} card={content.card} />
) : null}
{(((media as string) === "grid") && ((content.features?.length ?? 0) > 0)) ? (
<Box class="grid grid-cols-2 gap-4" data-slot="hero-grid">
<For each={content.features ?? []}>{(f, iOf) => { const i = iOf(); return (
<>
{(i < 4) ? (
<FigureBlock class="flex flex-col gap-2" testid="hero-tile">
<MediaFrame alt={f.title} src={f.image} ratio="1/1" />
<Text size="xs" class="text-muted-foreground">
{f.title}
</Text>
</FigureBlock>
) : null}
</>
); }}</For>
</Box>
) : null}
{(((media as string) === "plans") && ((content.plans?.length ?? 0) > 0)) ? (
<Box class="relative" data-slot="hero-media">
<MediaFrame alt={alt} src={image} ratio="4/3" />
<For each={content.plans ?? []}>{(p, iOf) => { const i = iOf(); return (
<>
{(i < 2) ? (
<Stack
gap="2"
class={cn(
"absolute w-48 rounded bg-card p-4 shadow-lg",
((i === 0) ? "top-8 left-4" : "right-4 bottom-8")
)}
data-slot="hero-plan"
>
<Text size="sm" weight="semibold">
{p.name}
</Text>
<Group gap="2" align="center">
<LucideIcon name="check" size={16} />
<Text size="xs" class="text-muted-foreground">
{p.tagline}
</Text>
</Group>
</Stack>
) : null}
</>
); }}</For>
</Box>
) : null}
</>
);
}
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-cdnnpx ui8kit add hero-split-media// 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/hero-split-media.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/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// HeroSplitMediaProps are the props of HeroSplitMedia; the values are the JSON shapes of the TypeScript props.
type HeroSplitMediaProps struct {
Content any `json:"content"`
Alt any `json:"alt"`
Image any `json:"image"`
Media any `json:"media"`
}
// What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with captions, or a picture with two plan cards floating over it.
templ HeroSplitMedia(p HeroSplitMediaProps) {
{{ vContent := p.Content }}
{{ vAlt := p.Alt }}
{{ vImage := p.Image }}
{{ vMedia := uiutils.Def(p.Media, "picture") }}
if uiutils.Eq(vMedia, "picture") {
@MediaFrame(MediaFrameProps{Alt: vAlt, Src: vImage, Ratio: "4/3"})
}
if uiutils.Eq(vMedia, "card") {
@OfferMedia(OfferMediaProps{Alt: vAlt, Image: vImage, Card: uiutils.Get(vContent, "card")})
}
if uiutils.T(uiutils.And(uiutils.Eq(vMedia, "grid"), uiutils.Gt(uiutils.Len(uiutils.Get(vContent, "features")), float64(0)))) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-2 gap-4", Attrs: uiutils.Attrs("data-slot", "hero-grid")}}) {
for vI, vF := range uiutils.L(uiutils.Get(vContent, "features")) {
if uiutils.Lt(float64(vI), float64(4)) {
@FigureBlock(FigureBlockProps{Class: uiutils.Cnv("flex flex-col gap-2"), Testid: "hero-tile"}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vF, "title"), Src: uiutils.Get(vF, "image"), Ratio: "1/1"})
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vF, "title")) }
}
}
}
}
}
}
if uiutils.T(uiutils.And(uiutils.Eq(vMedia, "plans"), uiutils.Gt(uiutils.Len(uiutils.Get(vContent, "plans")), float64(0)))) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "relative", Attrs: uiutils.Attrs("data-slot", "hero-media")}}) {
@MediaFrame(MediaFrameProps{Alt: vAlt, Src: vImage, Ratio: "4/3"})
for vI, vP := range uiutils.L(uiutils.Get(vContent, "plans")) {
if uiutils.Lt(float64(vI), float64(2)) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("absolute w-48 rounded bg-card p-4 shadow-lg", uiutils.Cond(uiutils.T(uiutils.Eq(float64(vI), float64(0))), "top-8 left-4", "right-4 bottom-8"))), Attrs: uiutils.Attrs("data-slot", "hero-plan")}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "name")) }
}
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: "check", Size: 16})
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vP, "tagline")) }
}
}
}
}
}
}
}
}
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-cdnnpx ui8kit add hero-split-media{#- 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/hero-split-media.json
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with captions, or a picture with two plan cards floating over it.
Props (p): content, alt, image, media. -#}
{%- set v_content = (p.content ?? null) -%}
{%- set v_alt = (p.alt ?? null) -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_media = (p.media ?? 'picture') -%}
{%- if og_t(og_eq(v_media, 'picture')) %}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': v_alt, 'src': v_image, 'ratio': '4/3'}}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_media, 'card')) %}
{{ include('blocks/offer-media.html.twig', {'p': {'alt': v_alt, 'image': v_image, 'card': og_get(v_content, ['card'])}}, with_context = false) }}
{%- endif %}
{%- if og_t(og_and([og_eq(v_media, 'grid'), og_gt(og_len(og_get(v_content, ['features'])), 0)])) %}
{%- set c_3 -%}
{%- for v_f in og_l(og_get(v_content, ['features'])) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_2 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_f, ['title']), 'src': og_get(v_f, ['image']), 'ratio': '1/1'}}, with_context = false) }}
{%- set c_1 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('blocks/figure-block.html.twig', {'p': {'className': og_cnv(['flex flex-col gap-2']), 'testid': 'hero-tile'}, 'children': og_markup(c_2)}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'grid grid-cols-2 gap-4', 'attrs': og_attrs(['data-slot', 'hero-grid']), 'children': c_3}, with_context = false) }}
{%- endif %}
{%- if og_t(og_and([og_eq(v_media, 'plans'), og_gt(og_len(og_get(v_content, ['plans'])), 0)])) %}
{%- set c_8 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': v_alt, 'src': v_image, 'ratio': '4/3'}}, with_context = false) }}
{%- for v_p in og_l(og_get(v_content, ['plans'])) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 2)) %}
{%- set c_7 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['name'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_4}, with_context = false) }}
{%- set c_6 -%}
{{ include('icons/LucideIcon.html.twig', {'name': 'check', 'size': 16}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['tagline'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': og_s(og_cnv(['absolute w-48 rounded bg-card p-4 shadow-lg', (og_t(og_eq(v_i, 0)) ? 'top-8 left-4' : 'right-4 bottom-8')])), 'attrs': og_attrs(['data-slot', 'hero-plan']), 'children': c_7}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'relative', 'attrs': og_attrs(['data-slot', 'hero-media']), 'children': c_8}, with_context = false) }}
{%- endif %}
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-cdnnpx ui8kit add hero-split-media{* 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/hero-split-media.json
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with captions, or a picture with two plan cards floating over it.
Props (p): content, alt, image, media. *}
{var $v_content = ($p['content'] ?? null)}
{var $v_alt = ($p['alt'] ?? null)}
{var $v_image = ($p['image'] ?? null)}
{var $v_media = ($p['media'] ?? 'picture')}
{if og_t(og_eq($v_media, 'picture'))}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => $v_alt, 'src' => $v_image, 'ratio' => '4/3']])|noescape}
{/if}
{if og_t(og_eq($v_media, 'card'))}
{=og_include('blocks/offer-media.latte', ['p' => ['alt' => $v_alt, 'image' => $v_image, 'card' => og_get($v_content, ['card'])]])|noescape}
{/if}
{if og_t(og_and([og_eq($v_media, 'grid'), og_gt(og_len(og_get($v_content, ['features'])), 0)]))}
{capture $c_3}
{foreach og_l(og_get($v_content, ['features'])) as $v_f}
{var $v_i = $iterator->counter0}
{if og_t(og_lt($v_i, 4))}
{capture $c_2}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_f, ['title']), 'src' => og_get($v_f, ['image']), 'ratio' => '1/1']])|noescape}
{capture $c_1}
{=og_text(og_get($v_f, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('blocks/figure-block.latte', ['p' => ['className' => og_cnv(['flex flex-col gap-2']), 'testid' => 'hero-tile'], 'children' => og_markup($c_2)])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'grid grid-cols-2 gap-4', 'attrs' => og_attrs(['data-slot', 'hero-grid']), 'children' => (string) $c_3])|noescape}
{/if}
{if og_t(og_and([og_eq($v_media, 'plans'), og_gt(og_len(og_get($v_content, ['plans'])), 0)]))}
{capture $c_8}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => $v_alt, 'src' => $v_image, 'ratio' => '4/3']])|noescape}
{foreach og_l(og_get($v_content, ['plans'])) as $v_p}
{var $v_i = $iterator->counter0}
{if og_t(og_lt($v_i, 2))}
{capture $c_7}
{capture $c_4}
{=og_text(og_get($v_p, ['name']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
{capture $c_6}
{=og_include('icons/LucideIcon.latte', ['name' => 'check', 'size' => 16])|noescape}
{capture $c_5}
{=og_text(og_get($v_p, ['tagline']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => og_s(og_cnv(['absolute w-48 rounded bg-card p-4 shadow-lg', (og_t(og_eq($v_i, 0)) ? 'top-8 left-4' : 'right-4 bottom-8')])), 'attrs' => og_attrs(['data-slot', 'hero-plan']), 'children' => (string) $c_7])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'relative', 'attrs' => og_attrs(['data-slot', 'hero-media']), 'children' => (string) $c_8])|noescape}
{/if}
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-cdnnpx ui8kit add hero-split-media{#- 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/hero-split-media.json
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with captions, or a picture with two plan cards floating over it.
Props (p): content, alt, image, media. -#}
{%- set v_content = og_def(p['content'], none) -%}
{%- set v_alt = og_def(p['alt'], none) -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_media = og_def(p['media'], 'picture') -%}
{%- if og_t(og_eq(v_media, 'picture')) %}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': v_alt, 'src': v_image, 'ratio': '4/3'}}) }}
{%- endif %}
{%- if og_t(og_eq(v_media, 'card')) %}
{{ og_include('blocks/offer-media.html.j2', {'p': {'alt': v_alt, 'image': v_image, 'card': og_get(v_content, ['card'])}}) }}
{%- endif %}
{%- if og_t(og_and([og_eq(v_media, 'grid'), og_gt(og_len(og_get(v_content, ['features'])), 0)])) %}
{%- set c_3 -%}
{%- for v_f in og_l(og_get(v_content, ['features'])) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_2 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_f, ['title']), 'src': og_get(v_f, ['image']), 'ratio': '1/1'}}) }}
{%- set c_1 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('blocks/figure-block.html.j2', {'p': {'className': og_cnv(['flex flex-col gap-2']), 'testid': 'hero-tile'}, 'children': og_markup(c_2)}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-2 gap-4', 'Attrs': og_attrs(['data-slot', 'hero-grid'])}, 'children': c_3}) }}
{%- endif %}
{%- if og_t(og_and([og_eq(v_media, 'plans'), og_gt(og_len(og_get(v_content, ['plans'])), 0)])) %}
{%- set c_8 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': v_alt, 'src': v_image, 'ratio': '4/3'}}) }}
{%- for v_p in og_l(og_get(v_content, ['plans'])) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 2)) %}
{%- set c_7 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['name'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_4}) }}
{%- set c_6 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'check', 'Size': 16}}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['tagline'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': og_s(og_cnv(['absolute w-48 rounded bg-card p-4 shadow-lg', ('top-8 left-4' if og_t(og_eq(v_i, 0)) else 'right-4 bottom-8')])), 'Attrs': og_attrs(['data-slot', 'hero-plan'])}, 'children': c_7}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'relative', 'Attrs': og_attrs(['data-slot', 'hero-media'])}, 'children': c_8}) }}
{%- endif %}
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.
What HeroSplit shows beside the text: a picture, a picture with a floating card, a grid of four pictures with captions, or a picture with two plan cards floating over it.
| Prop | Type | Default | Description |
|---|---|---|---|
| content (required) | HeroContent | - | the figures, small cards, people, proof line and floating card of the hero |
| alt (required) | string | - | accessible name of the picture |
| image | string | - | address of the picture (picture, card and plans media); none: the placeholder |
| media | "picture" | "card" | "grid" | "plans" | "picture" |