Skip to content
ui8kit

block / marketing

Hero Classic

Heading, lead, one or two actions and optional media.

Install

npx ui8kit add hero-classic

Pulls in: action-group, backdrop, box, button, code-window, compose, cta-actions, grid, group, input, kit-box, kit-button, kit-input, kit-label, label, media-frame, section-frame, topic-chips, utils

Preview

Websites that stay simple

A small toolkit for pages that load fast, read well and work for everyone.

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 hero-classic
blocks/hero-classic.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. -->
<!--
  The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster).
  Axes: layout, media kind and side, scale, tone, density, actions mode.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { HeroMedia } from "./hero-classic.types";
  import type { ActionSet } from "../components/cta-actions.types";
  import type { CodeLine } from "../components/code-window.types";
  import type { Topic } from "../components/topic-chips.types";

  export type HeroClassicProps = {
    id: string;
    title: string;
    text: string;
    level?: 1 | 2;
    badge?: string;
    topics?: Topic[];
    actions?: ActionSet;
    media?: HeroMedia;
    layout?: "centered" | "split";
    scale?: "default" | "display";
    tone?: "default" | "muted" | "inverse";
    density?: "roomy" | "default" | "compact";
    image?: string;
    imageAlt?: string;
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Grid from "../compose/Grid.svelte";
  import Group from "../compose/Group.svelte";
  import Input from "../compose/Input.svelte";
  import Label from "../compose/Label.svelte";
  import ActionGroup from "../components/action-group.svelte";
  import Backdrop from "../components/backdrop.svelte";
  import CodeWindow from "../components/code-window.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import TopicChips from "../components/topic-chips.svelte";
  import { cn, tpl, urlOf } from "../utils";

  let {
    id,
    title,
    text,
    level = 1,
    badge,
    topics,
    actions,
    media,
    layout = "centered",
    scale = "default",
    tone = "default",
    density = "roomy",
    image,
    imageAlt,
    landmarkLabel,
  }: HeroClassicProps = $props();
  const mediaKind = $derived(media?.kind ?? "none");
  const mediaSide = $derived(media?.side ?? "end");
</script>

<SectionFrame
  id={id}
  title={title}
  lead={text}
  heading={{ level, scale, badge }}
  layout={(((layout as string) === "split") ? "split" : "stack")}
  align={(((layout as string) === "split") ? "start" : "center")}
  media={{
    show: (((mediaKind as string) === "image") || ((mediaKind as string) === "code") || ((mediaKind as string) === "cluster")),
    side: mediaSide,
  }}
  tone={tone}
  density={density}
  class={
    (((mediaKind as string) === "backdrop") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
    : ""
  }
  landmarkLabel={landmarkLabel}
>
  <Backdrop
    kind={(((mediaKind as string) === "backdrop") ? "image" : "none")}
    alt={(imageAlt ? imageAlt : title)}
    image={image}
  />
  {#if actions?.cta}
    {#if (actions?.mode === "form")}
      <Box
        class={cn("w-full max-w-xl", (((layout as string) === "centered") ? "mx-auto" : ""))}
        data-slot="email-form"
      >
        <Label for={tpl("{0}-email", id)} class="sr-only">
          {actions?.emailLabel}
        </Label>
        <Group gap="2" align="start" class="w-full flex-wrap">
          <Input
            type="text"
            name="prompt"
            class="min-w-0 flex-1"
            placeholder={actions?.emailLabel}
            id={tpl("{0}-email", id)}
            data-slot="field"
          />
          <Button variant="default" size="default" href={urlOf(actions?.href)}>
            {actions?.cta}
          </Button>
        </Group>
      </Box>
    {:else}
      <ActionGroup
        primary={actions?.cta}
        primaryHref={actions?.href}
        secondary={((actions?.mode === "two") ? actions?.secondary : undefined)}
        secondaryHref={actions?.secondaryHref}
        align={(((layout as string) === "centered") ? "center" : "start")}
      />
    {/if}
  {/if}
  {#if (topics && ((topics?.length ?? 0) > 0))}
    <TopicChips topics={topics} />
  {/if}
  {#snippet aside()}
    {#if (((mediaKind as string) === "code") && media?.lines && ((media?.lines?.length ?? 0) > 0) && media?.codeTitle && media?.prompt)}
      <CodeWindow title={media?.codeTitle} prompt={media?.prompt} lines={media?.lines} />
    {/if}
    {#if ((mediaKind as string) === "cluster")}
      <Grid cols="3" class="items-end gap-4" data-slot="cluster">
        <Box class={cn("w-full", "")}>
          <MediaFrame alt={title} ratio="3/4" />
        </Box>
        <Box class={cn("w-full", "-translate-y-4")}>
          <MediaFrame alt={title} ratio="4/3" />
        </Box>
        <Box class={cn("w-full", "")}>
          <MediaFrame alt={title} ratio="3/4" />
        </Box>
      </Grid>
    {/if}
    {#if (((mediaKind as string) === "image"))}
      <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
    {/if}
  {/snippet}
</SectionFrame>
blocks/hero-classic.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.

import type { CodeLine } from "../components/code-window.types";

export type HeroMedia = {
  /** what the hero shows besides the text */
  kind?: "none" | "image" | "backdrop" | "code" | "cluster";
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** title of the code window */
  codeTitle?: string;
  /** prompt line of the code window */
  prompt?: string;
  /** lines of the code window */
  lines?: CodeLine[];
};

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 hero-classic
blocks/hero-classic.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.
/**
 * The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster).
 * Axes: layout, media kind and side, scale, tone, density, actions mode.
 */
import { type ReactNode } from "react";
import { Box, Button, Grid, Group, Input, Label } from "../compose";
import { ActionGroup } from "../components/action-group";
import { Backdrop } from "../components/backdrop";
import { CodeWindow } from "../components/code-window";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { TopicChips } from "../components/topic-chips";
import { cn, tpl, urlOf } from "../utils";
import type { HeroMedia } from "./hero-classic.types";
import type { ActionSet } from "../components/cta-actions.types";
import type { CodeLine } from "../components/code-window.types";
import type { Topic } from "../components/topic-chips.types";

export type HeroClassicProps = {
  id: string;
  title: string;
  text: string;
  level?: 1 | 2;
  badge?: string;
  topics?: Topic[];
  actions?: ActionSet;
  media?: HeroMedia;
  layout?: "centered" | "split";
  scale?: "default" | "display";
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function HeroClassic({
  id,
  title,
  text,
  level = 1,
  badge,
  topics,
  actions,
  media,
  layout = "centered",
  scale = "default",
  tone = "default",
  density = "roomy",
  image,
  imageAlt,
  landmarkLabel,
}: HeroClassicProps) {
  const mediaKind = media?.kind ?? "none";
  const mediaSide = media?.side ?? "end";
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={text}
      heading={{ level, scale, badge }}
      layout={(((layout as string) === "split") ? "split" : "stack")}
      align={(((layout as string) === "split") ? "start" : "center")}
      media={{
        show: (((mediaKind as string) === "image") || ((mediaKind as string) === "code") || ((mediaKind as string) === "cluster")),
        side: mediaSide,
      }}
      tone={tone}
      density={density}
      className={
        (((mediaKind as string) === "backdrop") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
        : ""
      }
      landmarkLabel={landmarkLabel}
      aside={(
        <>
          {(((mediaKind as string) === "code") && media?.lines && ((media?.lines?.length ?? 0) > 0) && media?.codeTitle && media?.prompt) ? (
            <CodeWindow title={media?.codeTitle} prompt={media?.prompt} lines={media?.lines} />
          ) : null}
          {((mediaKind as string) === "cluster") ? (
            <Grid cols="3" className="items-end gap-4" data-slot="cluster">
              <Box className={cn("w-full", "")}>
                <MediaFrame alt={title} ratio="3/4" />
              </Box>
              <Box className={cn("w-full", "-translate-y-4")}>
                <MediaFrame alt={title} ratio="4/3" />
              </Box>
              <Box className={cn("w-full", "")}>
                <MediaFrame alt={title} ratio="3/4" />
              </Box>
            </Grid>
          ) : null}
          {(((mediaKind as string) === "image")) ? (
            <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
          ) : null}
        </>
      )}
    >
      <Backdrop
        kind={(((mediaKind as string) === "backdrop") ? "image" : "none")}
        alt={(imageAlt ? imageAlt : title)}
        image={image}
      />
      {actions?.cta ? (
        <>
          {(actions?.mode === "form") ? (
            <Box
              className={cn("w-full max-w-xl", (((layout as string) === "centered") ? "mx-auto" : ""))}
              data-slot="email-form"
            >
              <Label htmlFor={tpl("{0}-email", id)} className="sr-only">
                {actions?.emailLabel}
              </Label>
              <Group gap="2" align="start" className="w-full flex-wrap">
                <Input
                  type="text"
                  name="prompt"
                  className="min-w-0 flex-1"
                  placeholder={actions?.emailLabel}
                  id={tpl("{0}-email", id)}
                  data-slot="field"
                />
                <Button variant="default" size="default" href={urlOf(actions?.href)}>
                  {actions?.cta}
                </Button>
              </Group>
            </Box>
          ) : (
            <ActionGroup
              primary={actions?.cta}
              primaryHref={actions?.href}
              secondary={((actions?.mode === "two") ? actions?.secondary : undefined)}
              secondaryHref={actions?.secondaryHref}
              align={(((layout as string) === "centered") ? "center" : "start")}
            />
          )}
        </>
      ) : null}
      {(topics && ((topics?.length ?? 0) > 0)) ? (
        <TopicChips topics={topics} />
      ) : null}
    </SectionFrame>
  );
}
blocks/hero-classic.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.

import type { CodeLine } from "../components/code-window.types";

export type HeroMedia = {
  /** what the hero shows besides the text */
  kind?: "none" | "image" | "backdrop" | "code" | "cluster";
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** title of the code window */
  codeTitle?: string;
  /** prompt line of the code window */
  prompt?: string;
  /** lines of the code window */
  lines?: CodeLine[];
};

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 hero-classic
blocks/hero-classic.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.

import type { CodeLine } from "../components/code-window.types";

export type HeroMedia = {
  /** what the hero shows besides the text */
  kind?: "none" | "image" | "backdrop" | "code" | "cluster";
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** title of the code window */
  codeTitle?: string;
  /** prompt line of the code window */
  prompt?: string;
  /** lines of the code window */
  lines?: CodeLine[];
};
blocks/hero-classic.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. -->
<!--
  The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster).
  Axes: layout, media kind and side, scale, tone, density, actions mode.
-->
<script lang="ts">
import type { HeroMedia } from "./hero-classic.types";
import type { ActionSet } from "../components/cta-actions.types";
import type { CodeLine } from "../components/code-window.types";
import type { Topic } from "../components/topic-chips.types";

export type HeroClassicProps = {
  id: string;
  title: string;
  text: string;
  level?: 1 | 2;
  badge?: string;
  topics?: Topic[];
  actions?: ActionSet;
  media?: HeroMedia;
  layout?: "centered" | "split";
  scale?: "default" | "display";
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import { computed } from "vue";
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import Input from "../compose/Input.vue";
import Label from "../compose/Label.vue";
import ActionGroup from "../components/action-group.vue";
import Backdrop from "../components/backdrop.vue";
import CodeWindow from "../components/code-window.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import TopicChips from "../components/topic-chips.vue";
import { cn, tpl, urlOf } from "../utils";

const {
  id,
  title,
  text,
  level = 1,
  badge,
  topics,
  actions,
  media,
  layout = "centered",
  scale = "default",
  tone = "default",
  density = "roomy",
  image,
  imageAlt,
  landmarkLabel,
} = defineProps<HeroClassicProps>();
const mediaKind = computed(() => media?.kind ?? "none");
const mediaSide = computed(() => media?.side ?? "end");
</script>

<template>
  <SectionFrame
    :id="id"
    :title="title"
    :lead="text"
    :heading="{ level, scale, badge }"
    :layout="(((layout as string) === 'split') ? 'split' : 'stack')"
    :align="(((layout as string) === 'split') ? 'start' : 'center')"
    :media="{
      show: (((mediaKind as string) === 'image') || ((mediaKind as string) === 'code') || ((mediaKind as string) === 'cluster')),
      side: mediaSide,
    }"
    :tone="tone"
    :density="density"
    :class="
      (((mediaKind as string) === 'backdrop') ? 'image' : 'none') === 'image' ? 'relative isolate overflow-hidden'
      : ''
    "
    :landmarkLabel="landmarkLabel"
  >
    <Backdrop
      :kind="(((mediaKind as string) === 'backdrop') ? 'image' : 'none')"
      :alt="(imageAlt ? imageAlt : title)"
      :image="image"
    />
    <template v-if="actions?.cta">
      <Box v-if="(actions?.mode === 'form')"
        :class="cn('w-full max-w-xl', (((layout as string) === 'centered') ? 'mx-auto' : ''))"
        data-slot="email-form"
      >
        <Label :for="tpl('{0}-email', id)" class="sr-only">
          {{ actions?.emailLabel }}
        </Label>
        <Group gap="2" align="start" class="w-full flex-wrap">
          <Input
            type="text"
            name="prompt"
            class="min-w-0 flex-1"
            :placeholder="actions?.emailLabel"
            :id="tpl('{0}-email', id)"
            data-slot="field"
          />
          <Button variant="default" size="default" :href="urlOf(actions?.href)">
            {{ actions?.cta }}
          </Button>
        </Group>
      </Box>
      <ActionGroup v-else
        :primary="actions?.cta"
        :primaryHref="actions?.href"
        :secondary="((actions?.mode === 'two') ? actions?.secondary : undefined)"
        :secondaryHref="actions?.secondaryHref"
        :align="(((layout as string) === 'centered') ? 'center' : 'start')"
      />
    </template>
    <TopicChips v-if="(topics && ((topics?.length ?? 0) > 0))" :topics="topics" />
    <template #aside>
      <CodeWindow
        v-if="(((mediaKind as string) === 'code') && media?.lines && ((media?.lines?.length ?? 0) > 0) && media?.codeTitle && media?.prompt)"
        :title="media?.codeTitle"
        :prompt="media?.prompt"
        :lines="media?.lines"
      />
      <Grid v-if="((mediaKind as string) === 'cluster')" cols="3" class="items-end gap-4" data-slot="cluster">
        <Box :class="cn('w-full', '')">
          <MediaFrame :alt="title" ratio="3/4" />
        </Box>
        <Box :class="cn('w-full', '-translate-y-4')">
          <MediaFrame :alt="title" ratio="4/3" />
        </Box>
        <Box :class="cn('w-full', '')">
          <MediaFrame :alt="title" ratio="3/4" />
        </Box>
      </Grid>
      <MediaFrame
        v-if="(((mediaKind as string) === 'image'))"
        :alt="(imageAlt ? imageAlt : title)"
        :src="image"
        ratio="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 hero-classic
blocks/hero-classic.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.
/**
 * The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster).
 * Axes: layout, media kind and side, scale, tone, density, actions mode.
 */
import { type JSX } from "solid-js";
import { Box, Button, Grid, Group, Input, Label } from "../compose";
import { ActionGroup } from "../components/action-group";
import { Backdrop } from "../components/backdrop";
import { CodeWindow } from "../components/code-window";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { TopicChips } from "../components/topic-chips";
import { cn, tpl, urlOf } from "../utils";
import type { HeroMedia } from "./hero-classic.types";
import type { ActionSet } from "../components/cta-actions.types";
import type { CodeLine } from "../components/code-window.types";
import type { Topic } from "../components/topic-chips.types";

export type HeroClassicProps = {
  id: string;
  title: string;
  text: string;
  level?: 1 | 2;
  badge?: string;
  topics?: Topic[];
  actions?: ActionSet;
  media?: HeroMedia;
  layout?: "centered" | "split";
  scale?: "default" | "display";
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function HeroClassic({
  id,
  title,
  text,
  level = 1,
  badge,
  topics,
  actions,
  media,
  layout = "centered",
  scale = "default",
  tone = "default",
  density = "roomy",
  image,
  imageAlt,
  landmarkLabel,
}: HeroClassicProps) {
  const mediaKind = media?.kind ?? "none";
  const mediaSide = media?.side ?? "end";
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={text}
      heading={{ level, scale, badge }}
      layout={(((layout as string) === "split") ? "split" : "stack")}
      align={(((layout as string) === "split") ? "start" : "center")}
      media={{
        show: (((mediaKind as string) === "image") || ((mediaKind as string) === "code") || ((mediaKind as string) === "cluster")),
        side: mediaSide,
      }}
      tone={tone}
      density={density}
      class={
        (((mediaKind as string) === "backdrop") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
        : ""
      }
      landmarkLabel={landmarkLabel}
      aside={(
        <>
          {(((mediaKind as string) === "code") && media?.lines && ((media?.lines?.length ?? 0) > 0) && media?.codeTitle && media?.prompt) ? (
            <CodeWindow title={media?.codeTitle} prompt={media?.prompt} lines={media?.lines} />
          ) : null}
          {((mediaKind as string) === "cluster") ? (
            <Grid cols="3" class="items-end gap-4" data-slot="cluster">
              <Box class={cn("w-full", "")}>
                <MediaFrame alt={title} ratio="3/4" />
              </Box>
              <Box class={cn("w-full", "-translate-y-4")}>
                <MediaFrame alt={title} ratio="4/3" />
              </Box>
              <Box class={cn("w-full", "")}>
                <MediaFrame alt={title} ratio="3/4" />
              </Box>
            </Grid>
          ) : null}
          {(((mediaKind as string) === "image")) ? (
            <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
          ) : null}
        </>
      )}
    >
      <Backdrop
        kind={(((mediaKind as string) === "backdrop") ? "image" : "none")}
        alt={(imageAlt ? imageAlt : title)}
        image={image}
      />
      {actions?.cta ? (
        <>
          {(actions?.mode === "form") ? (
            <Box
              class={cn("w-full max-w-xl", (((layout as string) === "centered") ? "mx-auto" : ""))}
              data-slot="email-form"
            >
              <Label for={tpl("{0}-email", id)} class="sr-only">
                {actions?.emailLabel}
              </Label>
              <Group gap="2" align="start" class="w-full flex-wrap">
                <Input
                  type="text"
                  name="prompt"
                  class="min-w-0 flex-1"
                  placeholder={actions?.emailLabel}
                  id={tpl("{0}-email", id)}
                  data-slot="field"
                />
                <Button variant="default" size="default" href={urlOf(actions?.href)}>
                  {actions?.cta}
                </Button>
              </Group>
            </Box>
          ) : (
            <ActionGroup
              primary={actions?.cta}
              primaryHref={actions?.href}
              secondary={((actions?.mode === "two") ? actions?.secondary : undefined)}
              secondaryHref={actions?.secondaryHref}
              align={(((layout as string) === "centered") ? "center" : "start")}
            />
          )}
        </>
      ) : null}
      {(topics && ((topics?.length ?? 0) > 0)) ? (
        <TopicChips topics={topics} />
      ) : null}
    </SectionFrame>
  );
}
blocks/hero-classic.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.

import type { CodeLine } from "../components/code-window.types";

export type HeroMedia = {
  /** what the hero shows besides the text */
  kind?: "none" | "image" | "backdrop" | "code" | "cluster";
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** title of the code window */
  codeTitle?: string;
  /** prompt line of the code window */
  prompt?: string;
  /** lines of the code window */
  lines?: CodeLine[];
};

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 hero-classic
blocks/hero-classic.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/hero-classic.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/ui/button"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/input"
	"github.com/ui8kit/codegen/generated/templ/ui/label"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// HeroClassicProps are the props of HeroClassic; the values are the JSON shapes of the TypeScript props.
type HeroClassicProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Level any `json:"level"`
	Badge any `json:"badge"`
	Topics any `json:"topics"`
	Actions any `json:"actions"`
	Media any `json:"media"`
	Layout any `json:"layout"`
	Scale any `json:"scale"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	Image any `json:"image"`
	ImageAlt any `json:"imageAlt"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster). Axes: layout, media kind and side, scale, tone, density, actions mode.
templ HeroClassic(p HeroClassicProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vLevel := uiutils.Def(p.Level, float64(1)) }}
	{{ vBadge := p.Badge }}
	{{ vTopics := p.Topics }}
	{{ vActions := p.Actions }}
	{{ vMedia := p.Media }}
	{{ vLayout := uiutils.Def(p.Layout, "centered") }}
	{{ vScale := uiutils.Def(p.Scale, "default") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vDensity := uiutils.Def(p.Density, "roomy") }}
	{{ vImage := p.Image }}
	{{ vImageAlt := p.ImageAlt }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	{{ vMediaKind := any(uiutils.Coalesce(uiutils.Get(vMedia, "kind"), "none")) }}
	{{ vMediaSide := any(uiutils.Coalesce(uiutils.Get(vMedia, "side"), "end")) }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vText, Heading: map[string]any{"level": vLevel, "scale": vScale, "badge": vBadge}, Layout: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "split", "stack"), Align: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "start", "center"), Media: map[string]any{"show": uiutils.Or(uiutils.Eq(vMediaKind, "image"), uiutils.Eq(vMediaKind, "code"), uiutils.Eq(vMediaKind, "cluster")), "side": vMediaSide}, Tone: vTone, Density: vDensity, Class: uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Cond(uiutils.T(uiutils.Eq(vMediaKind, "backdrop")), "image", "none"), "image")), "relative isolate overflow-hidden", "")), LandmarkLabel: vLandmarkLabel, Aside: heroClassicFill1(p, vTitle, vMedia, vImage, vImageAlt, vMediaKind)}) {
		@Backdrop(BackdropProps{Kind: uiutils.Cond(uiutils.T(uiutils.Eq(vMediaKind, "backdrop")), "image", "none"), Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Image: vImage})
		if uiutils.T(uiutils.Get(vActions, "cta")) {
			if uiutils.Eq(uiutils.Get(vActions, "mode"), "form") {
				@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full max-w-xl", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "centered")), "mx-auto", ""))), Attrs: uiutils.Attrs("data-slot", "email-form")}}) {
					@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{For: uiutils.S(uiutils.Tpl("{0}-email", vId)), Class: "sr-only"}}) {
						{ uiutils.Text(uiutils.Get(vActions, "emailLabel")) }
					}
					@compose.Group(compose.GroupProps{Gap: "2", Align: "start", BoxProps: box.BoxProps{Class: "w-full flex-wrap"}}) {
						@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "prompt", Class: "min-w-0 flex-1", Placeholder: uiutils.S(uiutils.Get(vActions, "emailLabel")), Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-email", vId), "data-slot", "field")}})
						@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Href: uiutils.URL(uiutils.Get(vActions, "href"), false)}}) {
							{ uiutils.Text(uiutils.Get(vActions, "cta")) }
						}
					}
				}
			} else {
				@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"), Align: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "centered")), "center", "start")})
			}
		}
		if uiutils.T(uiutils.And(vTopics, uiutils.Gt(uiutils.Len(vTopics), float64(0)))) {
			@TopicChips(TopicChipsProps{Topics: vTopics})
		}
	}
}

templ heroClassicFill1(p HeroClassicProps, vTitle any, vMedia any, vImage any, vImageAlt any, vMediaKind any) {
	if uiutils.T(uiutils.And(uiutils.Eq(vMediaKind, "code"), uiutils.Get(vMedia, "lines"), uiutils.Gt(uiutils.Len(uiutils.Get(vMedia, "lines")), float64(0)), uiutils.Get(vMedia, "codeTitle"), uiutils.Get(vMedia, "prompt"))) {
		@CodeWindow(CodeWindowProps{Title: uiutils.Get(vMedia, "codeTitle"), Prompt: uiutils.Get(vMedia, "prompt"), Lines: uiutils.Get(vMedia, "lines")})
	}
	if uiutils.Eq(vMediaKind, "cluster") {
		@compose.Grid(compose.GridProps{Cols: "3", BoxProps: box.BoxProps{Class: "items-end gap-4", Attrs: uiutils.Attrs("data-slot", "cluster")}}) {
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full", ""))}}) {
				@MediaFrame(MediaFrameProps{Alt: vTitle, Ratio: "3/4"})
			}
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full", "-translate-y-4"))}}) {
				@MediaFrame(MediaFrameProps{Alt: vTitle, Ratio: "4/3"})
			}
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full", ""))}}) {
				@MediaFrame(MediaFrameProps{Alt: vTitle, Ratio: "3/4"})
			}
		}
	}
	if uiutils.T(uiutils.Or(uiutils.Eq(vMediaKind, "image"))) {
		@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: "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 hero-classic
blocks/hero-classic.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/hero-classic.json
    The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster). Axes: layout, media kind and side, scale, tone, density, actions mode.
    Props (p): id, title, text, level, badge, topics, actions, media, layout, scale, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_level = (p.level ?? 1) -%}
{%- set v_badge = (p.badge ?? null) -%}
{%- set v_topics = (p.topics ?? null) -%}
{%- set v_actions = (p.actions ?? null) -%}
{%- set v_media = (p.media ?? null) -%}
{%- set v_layout = (p.layout ?? 'centered') -%}
{%- set v_scale = (p.scale ?? 'default') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'roomy') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set v_mediaKind = og_coalesce([og_get(v_media, ['kind']), 'none']) -%}
{%- set v_mediaSide = og_coalesce([og_get(v_media, ['side']), 'end']) -%}
{%- set f_5 -%}
  {%- if og_t(og_and([og_eq(v_mediaKind, 'code'), og_get(v_media, ['lines']), og_gt(og_len(og_get(v_media, ['lines'])), 0), og_get(v_media, ['codeTitle']), og_get(v_media, ['prompt'])])) %}
    {{ include('blocks/code-window.html.twig', {'p': {'title': og_get(v_media, ['codeTitle']), 'prompt': og_get(v_media, ['prompt']), 'lines': og_get(v_media, ['lines'])}}, with_context = false) }}
  {%- endif %}
  {%- if og_t(og_eq(v_mediaKind, 'cluster')) %}
    {%- set c_9 -%}
      {%- set c_6 -%}
        {{ include('blocks/media-frame.html.twig', {'p': {'alt': v_title, 'ratio': '3/4'}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['w-full', ''])), 'children': c_6}, with_context = false) }}
      {%- set c_7 -%}
        {{ include('blocks/media-frame.html.twig', {'p': {'alt': v_title, 'ratio': '4/3'}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['w-full', '-translate-y-4'])), 'children': c_7}, with_context = false) }}
      {%- set c_8 -%}
        {{ include('blocks/media-frame.html.twig', {'p': {'alt': v_title, 'ratio': '3/4'}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['w-full', ''])), 'children': c_8}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Grid.html.twig', {'cols': '3', 'class': 'items-end gap-4', 'attrs': og_attrs(['data-slot', 'cluster']), 'children': c_9}, with_context = false) }}
  {%- endif %}
  {%- if og_t(og_or([og_eq(v_mediaKind, 'image')])) %}
    {{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image, 'ratio': '4/3'}}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{%- set c_10 -%}
  {{ include('blocks/backdrop.html.twig', {'p': {'kind': (og_t(og_eq(v_mediaKind, 'backdrop')) ? 'image' : 'none'), 'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'image': v_image}}, with_context = false) }}
  {%- if og_t(og_get(v_actions, ['cta'])) %}
    {%- if og_t(og_eq(og_get(v_actions, ['mode']), 'form')) %}
      {%- set c_4 -%}
        {%- set c_1 -%}
          {{ og_text(og_get(v_actions, ['emailLabel'])) }}
        {%- endset -%}
        {{ include('compose/Label.html.twig', {'htmlFor': og_s(og_tpl('{0}-email', [v_id])), 'class': 'sr-only', 'children': c_1}, with_context = false) }}
        {%- set c_3 -%}
          {{ include('compose/Input.html.twig', {'type': 'text', 'name': 'prompt', 'class': 'min-w-0 flex-1', 'placeholder': og_s(og_get(v_actions, ['emailLabel'])), 'attrs': og_attrs(['id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
          {%- set c_2 -%}
            {{ og_text(og_get(v_actions, ['cta'])) }}
          {%- endset -%}
          {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'href': og_url(og_s(og_get(v_actions, ['href']))), 'children': c_2}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'start', 'class': 'w-full flex-wrap', 'children': c_3}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['w-full max-w-xl', (og_t(og_eq(v_layout, 'centered')) ? 'mx-auto' : '')])), 'attrs': og_attrs(['data-slot', 'email-form']), 'children': c_4}, with_context = false) }}
    {%- else %}
      {{ 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']), 'align': (og_t(og_eq(v_layout, 'centered')) ? 'center' : 'start')}}, with_context = false) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_and([v_topics, og_gt(og_len(v_topics), 0)])) %}
    {{ include('blocks/topic-chips.html.twig', {'p': {'topics': v_topics}}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'heading': {'level': v_level, 'scale': v_scale, 'badge': v_badge}, 'layout': (og_t(og_eq(v_layout, 'split')) ? 'split' : 'stack'), 'align': (og_t(og_eq(v_layout, 'split')) ? 'start' : 'center'), 'media': {'show': og_or([og_eq(v_mediaKind, 'image'), og_eq(v_mediaKind, 'code'), og_eq(v_mediaKind, 'cluster')]), 'side': v_mediaSide}, 'tone': v_tone, 'density': v_density, 'className': og_cnv([(og_t(og_eq((og_t(og_eq(v_mediaKind, 'backdrop')) ? 'image' : 'none'), 'image')) ? 'relative isolate overflow-hidden' : '')]), 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_5)}, 'children': og_markup(c_10)}, 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 hero-classic
blocks/hero-classic.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/hero-classic.json
    The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster). Axes: layout, media kind and side, scale, tone, density, actions mode.
    Props (p): id, title, text, level, badge, topics, actions, media, layout, scale, tone, density, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_level = ($p['level'] ?? 1)}
{var $v_badge = ($p['badge'] ?? null)}
{var $v_topics = ($p['topics'] ?? null)}
{var $v_actions = ($p['actions'] ?? null)}
{var $v_media = ($p['media'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'centered')}
{var $v_scale = ($p['scale'] ?? 'default')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'roomy')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{var $v_mediaKind = og_coalesce([og_get($v_media, ['kind']), 'none'])}
{var $v_mediaSide = og_coalesce([og_get($v_media, ['side']), 'end'])}
{capture $f_5}
  {if og_t(og_and([og_eq($v_mediaKind, 'code'), og_get($v_media, ['lines']), og_gt(og_len(og_get($v_media, ['lines'])), 0), og_get($v_media, ['codeTitle']), og_get($v_media, ['prompt'])]))}
    {=og_include('blocks/code-window.latte', ['p' => ['title' => og_get($v_media, ['codeTitle']), 'prompt' => og_get($v_media, ['prompt']), 'lines' => og_get($v_media, ['lines'])]])|noescape}
  {/if}
  {if og_t(og_eq($v_mediaKind, 'cluster'))}
    {capture $c_9}
      {capture $c_6}
        {=og_include('blocks/media-frame.latte', ['p' => ['alt' => $v_title, 'ratio' => '3/4']])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['w-full', ''])), 'children' => (string) $c_6])|noescape}
      {capture $c_7}
        {=og_include('blocks/media-frame.latte', ['p' => ['alt' => $v_title, 'ratio' => '4/3']])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['w-full', '-translate-y-4'])), 'children' => (string) $c_7])|noescape}
      {capture $c_8}
        {=og_include('blocks/media-frame.latte', ['p' => ['alt' => $v_title, 'ratio' => '3/4']])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['w-full', ''])), 'children' => (string) $c_8])|noescape}
    {/capture}
    {=og_include('compose/Grid.latte', ['cols' => '3', 'class' => 'items-end gap-4', 'attrs' => og_attrs(['data-slot', 'cluster']), 'children' => (string) $c_9])|noescape}
  {/if}
  {if og_t(og_or([og_eq($v_mediaKind, 'image')]))}
    {=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => '4/3']])|noescape}
  {/if}
{/capture}
{capture $c_10}
  {=og_include('blocks/backdrop.latte', ['p' => ['kind' => (og_t(og_eq($v_mediaKind, 'backdrop')) ? 'image' : 'none'), 'alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'image' => $v_image]])|noescape}
  {if og_t(og_get($v_actions, ['cta']))}
    {if og_t(og_eq(og_get($v_actions, ['mode']), 'form'))}
      {capture $c_4}
        {capture $c_1}
          {=og_text(og_get($v_actions, ['emailLabel']))}
        {/capture}
        {=og_include('compose/Label.latte', ['htmlFor' => og_s(og_tpl('{0}-email', [$v_id])), 'class' => 'sr-only', 'children' => (string) $c_1])|noescape}
        {capture $c_3}
          {=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'prompt', 'class' => 'min-w-0 flex-1', 'placeholder' => og_s(og_get($v_actions, ['emailLabel'])), 'attrs' => og_attrs(['id', og_tpl('{0}-email', [$v_id]), 'data-slot', 'field'])])|noescape}
          {capture $c_2}
            {=og_text(og_get($v_actions, ['cta']))}
          {/capture}
          {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'href' => og_url(og_s(og_get($v_actions, ['href']))), 'children' => (string) $c_2])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'start', 'class' => 'w-full flex-wrap', 'children' => (string) $c_3])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['w-full max-w-xl', (og_t(og_eq($v_layout, 'centered')) ? 'mx-auto' : '')])), 'attrs' => og_attrs(['data-slot', 'email-form']), 'children' => (string) $c_4])|noescape}
    {else}
      {=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']), 'align' => (og_t(og_eq($v_layout, 'centered')) ? 'center' : 'start')]])|noescape}
    {/if}
  {/if}
  {if og_t(og_and([$v_topics, og_gt(og_len($v_topics), 0)]))}
    {=og_include('blocks/topic-chips.latte', ['p' => ['topics' => $v_topics]])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_text, 'heading' => ['level' => $v_level, 'scale' => $v_scale, 'badge' => $v_badge], 'layout' => (og_t(og_eq($v_layout, 'split')) ? 'split' : 'stack'), 'align' => (og_t(og_eq($v_layout, 'split')) ? 'start' : 'center'), 'media' => ['show' => og_or([og_eq($v_mediaKind, 'image'), og_eq($v_mediaKind, 'code'), og_eq($v_mediaKind, 'cluster')]), 'side' => $v_mediaSide], 'tone' => $v_tone, 'density' => $v_density, 'className' => og_cnv([(og_t(og_eq((og_t(og_eq($v_mediaKind, 'backdrop')) ? 'image' : 'none'), 'image')) ? 'relative isolate overflow-hidden' : '')]), 'landmarkLabel' => $v_landmarkLabel, 'aside' => og_markup($f_5)], 'children' => og_markup($c_10)])|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 hero-classic
blocks/hero-classic.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/hero-classic.json
    The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster). Axes: layout, media kind and side, scale, tone, density, actions mode.
    Props (p): id, title, text, level, badge, topics, actions, media, layout, scale, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_level = og_def(p['level'], 1) -%}
{%- set v_badge = og_def(p['badge'], none) -%}
{%- set v_topics = og_def(p['topics'], none) -%}
{%- set v_actions = og_def(p['actions'], none) -%}
{%- set v_media = og_def(p['media'], none) -%}
{%- set v_layout = og_def(p['layout'], 'centered') -%}
{%- set v_scale = og_def(p['scale'], 'default') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'roomy') -%}
{%- 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 v_mediaKind = og_coalesce([og_get(v_media, ['kind']), 'none']) -%}
{%- set v_mediaSide = og_coalesce([og_get(v_media, ['side']), 'end']) -%}
{%- set f_5 -%}
  {%- if og_t(og_and([og_eq(v_mediaKind, 'code'), og_get(v_media, ['lines']), og_gt(og_len(og_get(v_media, ['lines'])), 0), og_get(v_media, ['codeTitle']), og_get(v_media, ['prompt'])])) %}
    {{ og_include('blocks/code-window.html.j2', {'p': {'title': og_get(v_media, ['codeTitle']), 'prompt': og_get(v_media, ['prompt']), 'lines': og_get(v_media, ['lines'])}}) }}
  {%- endif %}
  {%- if og_t(og_eq(v_mediaKind, 'cluster')) %}
    {%- set c_9 -%}
      {%- set c_6 -%}
        {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': v_title, 'ratio': '3/4'}}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['w-full', '']))}, 'children': c_6}) }}
      {%- set c_7 -%}
        {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': v_title, 'ratio': '4/3'}}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['w-full', '-translate-y-4']))}, 'children': c_7}) }}
      {%- set c_8 -%}
        {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': v_title, 'ratio': '3/4'}}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['w-full', '']))}, 'children': c_8}) }}
    {%- endset -%}
    {{ og_include('compose/grid.html.j2', {'p': {'Cols': '3', 'Class': 'items-end gap-4', 'Attrs': og_attrs(['data-slot', 'cluster'])}, 'children': c_9}) }}
  {%- endif %}
  {%- if og_t(og_or([og_eq(v_mediaKind, 'image')])) %}
    {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'src': v_image, 'ratio': '4/3'}}) }}
  {%- endif %}
{%- endset -%}
{%- set c_10 -%}
  {{ og_include('blocks/backdrop.html.j2', {'p': {'kind': ('image' if og_t(og_eq(v_mediaKind, 'backdrop')) else 'none'), 'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'image': v_image}}) }}
  {%- if og_t(og_get(v_actions, ['cta'])) %}
    {%- if og_t(og_eq(og_get(v_actions, ['mode']), 'form')) %}
      {%- set c_4 -%}
        {%- set c_1 -%}
          {{ og_text(og_get(v_actions, ['emailLabel'])) }}
        {%- endset -%}
        {{ og_include('compose/label.html.j2', {'p': {'For': og_s(og_tpl('{0}-email', [v_id])), 'Class': 'sr-only'}, 'children': c_1}) }}
        {%- set c_3 -%}
          {{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'prompt', 'Class': 'min-w-0 flex-1', 'Placeholder': og_s(og_get(v_actions, ['emailLabel'])), 'Attrs': og_attrs(['id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}}) }}
          {%- set c_2 -%}
            {{ og_text(og_get(v_actions, ['cta'])) }}
          {%- endset -%}
          {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Href': og_url(og_s(og_get(v_actions, ['href'])))}, 'children': c_2}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'start', 'Class': 'w-full flex-wrap'}, 'children': c_3}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['w-full max-w-xl', ('mx-auto' if og_t(og_eq(v_layout, 'centered')) else '')])), 'Attrs': og_attrs(['data-slot', 'email-form'])}, 'children': c_4}) }}
    {%- else %}
      {{ 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']), 'align': ('center' if og_t(og_eq(v_layout, 'centered')) else 'start')}}) }}
    {%- endif %}
  {%- endif %}
  {%- if og_t(og_and([v_topics, og_gt(og_len(v_topics), 0)])) %}
    {{ og_include('blocks/topic-chips.html.j2', {'p': {'topics': v_topics}}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'heading': {'level': v_level, 'scale': v_scale, 'badge': v_badge}, 'layout': ('split' if og_t(og_eq(v_layout, 'split')) else 'stack'), 'align': ('start' if og_t(og_eq(v_layout, 'split')) else 'center'), 'media': {'show': og_or([og_eq(v_mediaKind, 'image'), og_eq(v_mediaKind, 'code'), og_eq(v_mediaKind, 'cluster')]), 'side': v_mediaSide}, 'tone': v_tone, 'density': v_density, 'className': og_cnv([('relative isolate overflow-hidden' if og_t(og_eq(('image' if og_t(og_eq(v_mediaKind, 'backdrop')) else 'none'), 'image')) else '')]), 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_5)}, 'children': og_markup(c_10)}) }}

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.

The top of a page: heading, lead and actions, with optional media (image, backdrop, code window, cluster). Axes: layout, media kind and side, scale, tone, density, actions mode.

Props of HeroClassic
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-
level 1 | 21
badge string-
topics Topic[]-
actions ActionSet-
media HeroMedia-
layout "centered" | "split""centered"
scale "default" | "display""default"
tone "default" | "muted" | "inverse""default"
density "roomy" | "default" | "compact""roomy"
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