Skip to content
ui8kit

component / components

Section Frame

Section Frame component

Install

npx ui8kit add section-frame

Pulls in: block, box, compose, container, grid, kit-box, presets, section-box, section-column, section-header, stack, utils

Preview

Available for projects

Hi, I design calm software

Nine years of product design for teams that ship every week. I like systems, plain words and short feedback loops.

Design systems

95%

User research

85%

Prototyping

90%

Frontend code

70%

Product writing

80%

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 section-frame
components/section-frame.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body
  (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts
  the body in a card. Axes: layout, media side, tone, density, align.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { SectionHeading, HeadLink, SectionMedia } from "./section-frame.types";
  import { variants } from "../utils";

  /** SectionFrame: the classes of each value (shadcn/cva style). */
  export const sectionFrameVariants = variants({
    base: "w-full",
    variants: {
      tone: {
        default: "",
        muted: "bg-muted",
        inverse: "bg-foreground text-background [&_.text-muted-foreground]:text-background/70",
      },
      density: {
        roomy: "py-16",
        default: "py-10",
        compact: "py-6",
        flush: "py-0",
      },
      align: {
        start: "",
        center: "text-center",
      },
    },
    defaultVariants: { tone: "default", density: "default", align: "start" },
  });

  export type SectionFrameProps = {
    id: string;
    title?: string;
    lead?: string;
    heading?: SectionHeading;
    action?: HeadLink;
    layout?: "stack" | "split";
    media?: SectionMedia;
    boxed?: boolean;
    tone?: "default" | "muted" | "inverse";
    density?: "roomy" | "default" | "compact" | "flush";
    align?: "start" | "center";
    measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
    landmarkLabel?: string;
    class?: string;
    children?: Snippet;
    aside?: Snippet;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Box from "../compose/Box.svelte";
  import Container from "../compose/Container.svelte";
  import Grid from "../compose/Grid.svelte";
  import Stack from "../compose/Stack.svelte";
  import SectionBox from "../components/section-box.svelte";
  import SectionColumn from "../components/section-column.svelte";
  import SectionHeader from "../components/section-header.svelte";
  import { defaults } from "../presets/defaults";
  import { cn } from "../utils";

  let {
    id,
    title = "",
    lead,
    heading,
    action,
    layout = "stack",
    media,
    boxed = false,
    tone = "default",
    density = "default",
    align = "start",
    measure = "default",
    landmarkLabel,
    class: className,
    children,
    aside,
  }: SectionFrameProps = $props();
  const titleId = $derived(id + "-title");
  const sectionTone = $derived(boxed ? "default" : tone);
  const center = $derived((align as string) === "center");
</script>

<Block
  tag="section"
  class={cn(sectionFrameVariants({ tone: sectionTone, density: density, align: align }), className)}
  aria-labelledby={(landmarkLabel ? undefined : (((title as string) !== "") ? titleId : undefined))}
  aria-label={(landmarkLabel ?? (((title as string) === "") ? id : undefined))}
  data-tone={tone}
  data-density={density}
  data-slot="section"
>
  <Container
    class={
      (measure as string) === "landing" ? cn("mx-auto w-full px-4", defaults.section.landing)
      : (measure as string) === "fill" ? "w-full"
      : "mx-auto w-full max-w-6xl px-4"
    }
    data-slot="container"
  >
    <SectionBox boxed={boxed}>
      {#if ((layout as string) === "split")}
        <Grid cols="1-2" class={cn("gap-8", ((media?.align === "start") ? "items-start" : "items-center"))}>
          {#if (media?.show && (media?.side === "start"))}
            <Box class="w-full" data-slot="media">
              {@render aside?.()}
            </Box>
          {/if}
          <Stack gap="6" align="stretch">
            <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
            {@render children?.()}
          </Stack>
          {#if (media?.show && (media?.side !== "start"))}
            <Box class="w-full" data-slot="media">
              {@render aside?.()}
            </Box>
          {/if}
        </Grid>
      {:else}
        <SectionColumn measure={measure}>
          <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
          {@render children?.()}
          {#if media?.show}
            <Box class="w-full" data-slot="media">
              {@render aside?.()}
            </Box>
          {/if}
        </SectionColumn>
      {/if}
    </SectionBox>
  </Container>
</Block>
components/section-frame.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type SectionHeading = {
  /** heading level */
  level?: 1 | 2;
  /** display: an oversized heading */
  scale?: "default" | "display";
  /** a short pill above the heading (e.g. New) */
  badge?: string;
};

export type HeadLink = {
  /** text of the link (View all, Browse all); none: no link */
  label?: string;
  /** href of the link; none: no link */
  href?: string;
};

export type SectionMedia = {
  /** the `aside` slot is shown */
  show?: boolean;
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** split layout: the body and the media centred on each other, or both from the top */
  align?: "center" | "start";
};

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 section-frame
components/section-frame.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body
 * (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts
 * the body in a card. Axes: layout, media side, tone, density, align.
 */
import { type ReactNode } from "react";
import { Block, Box, Container, Grid, Stack } from "../compose";
import { SectionBox } from "../components/section-box";
import { SectionColumn } from "../components/section-column";
import { SectionHeader } from "../components/section-header";
import { defaults } from "../presets/defaults";
import { cn, variants } from "../utils";
import type { SectionHeading, HeadLink, SectionMedia } from "./section-frame.types";

/** SectionFrame: the classes of each value (shadcn/cva style). */
export const sectionFrameVariants = variants({
  base: "w-full",
  variants: {
    tone: {
      default: "",
      muted: "bg-muted",
      inverse: "bg-foreground text-background [&_.text-muted-foreground]:text-background/70",
    },
    density: {
      roomy: "py-16",
      default: "py-10",
      compact: "py-6",
      flush: "py-0",
    },
    align: {
      start: "",
      center: "text-center",
    },
  },
  defaultVariants: { tone: "default", density: "default", align: "start" },
});

export type SectionFrameProps = {
  id: string;
  title?: string;
  lead?: string;
  heading?: SectionHeading;
  action?: HeadLink;
  layout?: "stack" | "split";
  media?: SectionMedia;
  boxed?: boolean;
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact" | "flush";
  align?: "start" | "center";
  measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
  landmarkLabel?: string;
  className?: string;
  children?: ReactNode;
  aside?: ReactNode;
};

export function SectionFrame({
  id,
  title = "",
  lead,
  heading,
  action,
  layout = "stack",
  media,
  boxed = false,
  tone = "default",
  density = "default",
  align = "start",
  measure = "default",
  landmarkLabel,
  className,
  children,
  aside,
}: SectionFrameProps) {
  const titleId = id + "-title";
  const sectionTone = boxed ? "default" : tone;
  const center = (align as string) === "center";
  return (
    <Block
      tag="section"
      className={cn(
        sectionFrameVariants({ tone: sectionTone, density: density, align: align }),
        className
      )}
      aria-labelledby={(landmarkLabel ? undefined : (((title as string) !== "") ? titleId : undefined))}
      aria-label={(landmarkLabel ?? (((title as string) === "") ? id : undefined))}
      data-tone={tone}
      data-density={density}
      data-slot="section"
    >
      <Container
        className={
          (measure as string) === "landing" ? cn("mx-auto w-full px-4", defaults.section.landing)
          : (measure as string) === "fill" ? "w-full"
          : "mx-auto w-full max-w-6xl px-4"
        }
        data-slot="container"
      >
        <SectionBox boxed={boxed}>
          {((layout as string) === "split") ? (
            <Grid cols="1-2" className={cn("gap-8", ((media?.align === "start") ? "items-start" : "items-center"))}>
              {(media?.show && (media?.side === "start")) ? (
                <Box className="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
              <Stack gap="6" align="stretch">
                <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
                {children}
              </Stack>
              {(media?.show && (media?.side !== "start")) ? (
                <Box className="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
            </Grid>
          ) : (
            <SectionColumn measure={measure}>
              <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
              {children}
              {media?.show ? (
                <Box className="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
            </SectionColumn>
          )}
        </SectionBox>
      </Container>
    </Block>
  );
}
components/section-frame.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type SectionHeading = {
  /** heading level */
  level?: 1 | 2;
  /** display: an oversized heading */
  scale?: "default" | "display";
  /** a short pill above the heading (e.g. New) */
  badge?: string;
};

export type HeadLink = {
  /** text of the link (View all, Browse all); none: no link */
  label?: string;
  /** href of the link; none: no link */
  href?: string;
};

export type SectionMedia = {
  /** the `aside` slot is shown */
  show?: boolean;
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** split layout: the body and the media centred on each other, or both from the top */
  align?: "center" | "start";
};

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 section-frame
components/section-frame.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type SectionHeading = {
  /** heading level */
  level?: 1 | 2;
  /** display: an oversized heading */
  scale?: "default" | "display";
  /** a short pill above the heading (e.g. New) */
  badge?: string;
};

export type HeadLink = {
  /** text of the link (View all, Browse all); none: no link */
  label?: string;
  /** href of the link; none: no link */
  href?: string;
};

export type SectionMedia = {
  /** the `aside` slot is shown */
  show?: boolean;
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** split layout: the body and the media centred on each other, or both from the top */
  align?: "center" | "start";
};
components/section-frame.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body
  (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts
  the body in a card. Axes: layout, media side, tone, density, align.
-->
<script lang="ts">
import type { SectionHeading, HeadLink, SectionMedia } from "./section-frame.types";
import { variants } from "../utils";

/** SectionFrame: the classes of each value (shadcn/cva style). */
export const sectionFrameVariants = variants({
  base: "w-full",
  variants: {
    tone: {
      default: "",
      muted: "bg-muted",
      inverse: "bg-foreground text-background [&_.text-muted-foreground]:text-background/70",
    },
    density: {
      roomy: "py-16",
      default: "py-10",
      compact: "py-6",
      flush: "py-0",
    },
    align: {
      start: "",
      center: "text-center",
    },
  },
  defaultVariants: { tone: "default", density: "default", align: "start" },
});

export type SectionFrameProps = {
  id: string;
  title?: string;
  lead?: string;
  heading?: SectionHeading;
  action?: HeadLink;
  layout?: "stack" | "split";
  media?: SectionMedia;
  boxed?: boolean;
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact" | "flush";
  align?: "start" | "center";
  measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
  landmarkLabel?: string;
  class?: string;
};
</script>

<script setup lang="ts">
import { computed } from "vue";
import Block from "../compose/Block.vue";
import Box from "../compose/Box.vue";
import Container from "../compose/Container.vue";
import Grid from "../compose/Grid.vue";
import Stack from "../compose/Stack.vue";
import SectionBox from "../components/section-box.vue";
import SectionColumn from "../components/section-column.vue";
import SectionHeader from "../components/section-header.vue";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";

const {
  id,
  title = "",
  lead,
  heading,
  action,
  layout = "stack",
  media,
  boxed = false,
  tone = "default",
  density = "default",
  align = "start",
  measure = "default",
  landmarkLabel,
  class: className,
} = defineProps<SectionFrameProps>();
defineSlots<{ default?(): unknown, aside?(): unknown }>();
const titleId = computed(() => id + "-title");
const sectionTone = computed(() => boxed ? "default" : tone);
const center = computed(() => (align as string) === "center");
</script>

<template>
  <Block
    tag="section"
    :class="cn(sectionFrameVariants({ tone: sectionTone, density: density, align: align }), className)"
    :aria-labelledby="(landmarkLabel ? undefined : (((title as string) !== '') ? titleId : undefined))"
    :aria-label="(landmarkLabel ?? (((title as string) === '') ? id : undefined))"
    :data-tone="tone"
    :data-density="density"
    data-slot="section"
  >
    <Container
      :class="
        (measure as string) === 'landing' ? cn('mx-auto w-full px-4', defaults.section.landing)
        : (measure as string) === 'fill' ? 'w-full'
        : 'mx-auto w-full max-w-6xl px-4'
      "
      data-slot="container"
    >
      <SectionBox :boxed="boxed">
        <Grid
          v-if="((layout as string) === 'split')"
          cols="1-2"
          :class="cn('gap-8', ((media?.align === 'start') ? 'items-start' : 'items-center'))"
        >
          <Box v-if="(media?.show && (media?.side === 'start'))" class="w-full" data-slot="media">
            <slot name="aside" />
          </Box>
          <Stack gap="6" align="stretch">
            <SectionHeader
              :titleId="titleId"
              :title="title"
              :heading="heading"
              :action="action"
              :lead="lead"
              :center="center"
            />
            <slot />
          </Stack>
          <Box v-if="(media?.show && (media?.side !== 'start'))" class="w-full" data-slot="media">
            <slot name="aside" />
          </Box>
        </Grid>
        <SectionColumn v-else :measure="measure">
          <SectionHeader
            :titleId="titleId"
            :title="title"
            :heading="heading"
            :action="action"
            :lead="lead"
            :center="center"
          />
          <slot />
          <Box v-if="media?.show" class="w-full" data-slot="media">
            <slot name="aside" />
          </Box>
        </SectionColumn>
      </SectionBox>
    </Container>
  </Block>
</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 section-frame
components/section-frame.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body
 * (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts
 * the body in a card. Axes: layout, media side, tone, density, align.
 */
import { type JSX } from "solid-js";
import { Block, Box, Container, Grid, Stack } from "../compose";
import { SectionBox } from "../components/section-box";
import { SectionColumn } from "../components/section-column";
import { SectionHeader } from "../components/section-header";
import { defaults } from "../presets/defaults";
import { cn, variants } from "../utils";
import type { SectionHeading, HeadLink, SectionMedia } from "./section-frame.types";

/** SectionFrame: the classes of each value (shadcn/cva style). */
export const sectionFrameVariants = variants({
  base: "w-full",
  variants: {
    tone: {
      default: "",
      muted: "bg-muted",
      inverse: "bg-foreground text-background [&_.text-muted-foreground]:text-background/70",
    },
    density: {
      roomy: "py-16",
      default: "py-10",
      compact: "py-6",
      flush: "py-0",
    },
    align: {
      start: "",
      center: "text-center",
    },
  },
  defaultVariants: { tone: "default", density: "default", align: "start" },
});

export type SectionFrameProps = {
  id: string;
  title?: string;
  lead?: string;
  heading?: SectionHeading;
  action?: HeadLink;
  layout?: "stack" | "split";
  media?: SectionMedia;
  boxed?: boolean;
  tone?: "default" | "muted" | "inverse";
  density?: "roomy" | "default" | "compact" | "flush";
  align?: "start" | "center";
  measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
  landmarkLabel?: string;
  class?: string;
  children?: JSX.Element;
  aside?: JSX.Element;
};

export function SectionFrame({
  id,
  title = "",
  lead,
  heading,
  action,
  layout = "stack",
  media,
  boxed = false,
  tone = "default",
  density = "default",
  align = "start",
  measure = "default",
  landmarkLabel,
  class: className,
  children,
  aside,
}: SectionFrameProps) {
  const titleId = id + "-title";
  const sectionTone = boxed ? "default" : tone;
  const center = (align as string) === "center";
  return (
    <Block
      tag="section"
      class={cn(sectionFrameVariants({ tone: sectionTone, density: density, align: align }), className)}
      aria-labelledby={(landmarkLabel ? undefined : (((title as string) !== "") ? titleId : undefined))}
      aria-label={(landmarkLabel ?? (((title as string) === "") ? id : undefined))}
      data-tone={tone}
      data-density={density}
      data-slot="section"
    >
      <Container
        class={
          (measure as string) === "landing" ? cn("mx-auto w-full px-4", defaults.section.landing)
          : (measure as string) === "fill" ? "w-full"
          : "mx-auto w-full max-w-6xl px-4"
        }
        data-slot="container"
      >
        <SectionBox boxed={boxed}>
          {((layout as string) === "split") ? (
            <Grid cols="1-2" class={cn("gap-8", ((media?.align === "start") ? "items-start" : "items-center"))}>
              {(media?.show && (media?.side === "start")) ? (
                <Box class="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
              <Stack gap="6" align="stretch">
                <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
                {children}
              </Stack>
              {(media?.show && (media?.side !== "start")) ? (
                <Box class="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
            </Grid>
          ) : (
            <SectionColumn measure={measure}>
              <SectionHeader titleId={titleId} title={title} heading={heading} action={action} lead={lead} center={center} />
              {children}
              {media?.show ? (
                <Box class="w-full" data-slot="media">
                  {aside}
                </Box>
              ) : null}
            </SectionColumn>
          )}
        </SectionBox>
      </Container>
    </Block>
  );
}
components/section-frame.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type SectionHeading = {
  /** heading level */
  level?: 1 | 2;
  /** display: an oversized heading */
  scale?: "default" | "display";
  /** a short pill above the heading (e.g. New) */
  badge?: string;
};

export type HeadLink = {
  /** text of the link (View all, Browse all); none: no link */
  label?: string;
  /** href of the link; none: no link */
  href?: string;
};

export type SectionMedia = {
  /** the `aside` slot is shown */
  show?: boolean;
  /** side of the media in the split layout */
  side?: "end" | "start";
  /** split layout: the body and the media centred on each other, or both from the top */
  align?: "center" | "start";
};

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 section-frame
blocks/section-frame.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/patterns/section-frame.json

package blocks

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

// SectionFrameProps are the props of SectionFrame; the values are the JSON shapes of the TypeScript props.
type SectionFrameProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Lead any `json:"lead"`
	Heading any `json:"heading"`
	Action any `json:"action"`
	Layout any `json:"layout"`
	Media any `json:"media"`
	Boxed any `json:"boxed"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	Align any `json:"align"`
	Measure any `json:"measure"`
	LandmarkLabel any `json:"landmarkLabel"`
	Class string `json:"className"`
	Aside templ.Component `json:"-"`
}

// A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts the body in a card. Axes: layout, media side, tone, density, align.
templ SectionFrame(p SectionFrameProps) {
	{{ vId := p.Id }}
	{{ vTitle := uiutils.Def(p.Title, "") }}
	{{ vLead := p.Lead }}
	{{ vHeading := p.Heading }}
	{{ vAction := p.Action }}
	{{ vLayout := uiutils.Def(p.Layout, "stack") }}
	{{ vMedia := p.Media }}
	{{ vBoxed := uiutils.Def(p.Boxed, false) }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vAlign := uiutils.Def(p.Align, "start") }}
	{{ vMeasure := uiutils.Def(p.Measure, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	{{ vTitleId := any(uiutils.Add(vId, "-title")) }}
	{{ vSectionTone := any(uiutils.Cond(uiutils.T(vBoxed), "default", vTone)) }}
	{{ vCenter := any(uiutils.Eq(vAlign, "center")) }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Class: uiutils.S(uiutils.Cnv(recipeSectionFrame.Of(map[string]any{"tone": vSectionTone, "density": vDensity, "align": vAlign}), p.Class)), Attrs: uiutils.Attrs("aria-labelledby", uiutils.Cond(uiutils.T(vLandmarkLabel), nil, uiutils.Cond(uiutils.T(!uiutils.Eq(vTitle, "")), vTitleId, nil)), "aria-label", uiutils.Coalesce(vLandmarkLabel, uiutils.Cond(uiutils.T(uiutils.Eq(vTitle, "")), vId, nil)), "data-tone", vTone, "data-density", vDensity, "data-slot", "section")}}) {
		@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vMeasure, "landing")), uiutils.Cnv("mx-auto w-full px-4", uiutils.Get(presetDefaults, "section", "landing")), uiutils.Cond(uiutils.T(uiutils.Eq(vMeasure, "fill")), "w-full", "mx-auto w-full max-w-6xl px-4"))), Attrs: uiutils.Attrs("data-slot", "container")}}) {
			@SectionBox(SectionBoxProps{Boxed: vBoxed}) {
				if uiutils.Eq(vLayout, "split") {
					@compose.Grid(compose.GridProps{Cols: "1-2", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("gap-8", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vMedia, "align"), "start")), "items-start", "items-center")))}}) {
						if uiutils.T(uiutils.And(uiutils.Get(vMedia, "show"), uiutils.Eq(uiutils.Get(vMedia, "side"), "start"))) {
							@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "w-full", Attrs: uiutils.Attrs("data-slot", "media")}}) {
								if p.Aside != nil {
									@p.Aside
								}
							}
						}
						@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{}}) {
							@SectionHeader(SectionHeaderProps{TitleId: vTitleId, Title: vTitle, Heading: vHeading, Action: vAction, Lead: vLead, Center: vCenter})
							{ children... }
						}
						if uiutils.T(uiutils.And(uiutils.Get(vMedia, "show"), !uiutils.Eq(uiutils.Get(vMedia, "side"), "start"))) {
							@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "w-full", Attrs: uiutils.Attrs("data-slot", "media")}}) {
								if p.Aside != nil {
									@p.Aside
								}
							}
						}
					}
				} else {
					@SectionColumn(SectionColumnProps{Measure: vMeasure}) {
						@SectionHeader(SectionHeaderProps{TitleId: vTitleId, Title: vTitle, Heading: vHeading, Action: vAction, Lead: vLead, Center: vCenter})
						{ children... }
						if uiutils.T(uiutils.Get(vMedia, "show")) {
							@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "w-full", Attrs: uiutils.Attrs("data-slot", "media")}}) {
								if p.Aside != nil {
									@p.Aside
								}
							}
						}
					}
				}
			}
		}
	}
}

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 section-frame
blocks/section-frame.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/patterns/section-frame.json
    A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts the body in a card. Axes: layout, media side, tone, density, align.
    Props (p): id, title, lead, heading, action, layout, media, boxed, tone, density, align, measure, landmarkLabel, className, aside (slot); children: markup. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? '') -%}
{%- set v_lead = (p.lead ?? null) -%}
{%- set v_heading = (p.heading ?? null) -%}
{%- set v_action = (p.action ?? null) -%}
{%- set v_layout = (p.layout ?? 'stack') -%}
{%- set v_media = (p.media ?? null) -%}
{%- set v_boxed = (p.boxed ?? false) -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_align = (p.align ?? 'start') -%}
{%- set v_measure = (p.measure ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set v_titleId = og_add(v_id, '-title') -%}
{%- set v_sectionTone = (og_t(v_boxed) ? 'default' : v_tone) -%}
{%- set v_center = og_eq(v_align, 'center') -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_7 -%}
      {%- if og_t(og_eq(v_layout, 'split')) %}
        {%- set c_4 -%}
          {%- if og_t(og_and([og_get(v_media, ['show']), og_eq(og_get(v_media, ['side']), 'start')])) %}
            {%- set c_1 -%}
              {{ og_slot((p.aside ?? null))|raw }}
            {%- endset -%}
            {{ include('compose/Box.html.twig', {'class': 'w-full', 'attrs': og_attrs(['data-slot', 'media']), 'children': c_1}, with_context = false) }}
          {%- endif %}
          {%- set c_2 -%}
            {{ include('blocks/section-header.html.twig', {'p': {'titleId': v_titleId, 'title': v_title, 'heading': v_heading, 'action': v_action, 'lead': v_lead, 'center': v_center}}, with_context = false) }}
            {{ og_slot((children ?? null))|raw }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'children': c_2}, with_context = false) }}
          {%- if og_t(og_and([og_get(v_media, ['show']), not (og_eq(og_get(v_media, ['side']), 'start'))])) %}
            {%- set c_3 -%}
              {{ og_slot((p.aside ?? null))|raw }}
            {%- endset -%}
            {{ include('compose/Box.html.twig', {'class': 'w-full', 'attrs': og_attrs(['data-slot', 'media']), 'children': c_3}, with_context = false) }}
          {%- endif %}
        {%- endset -%}
        {{ include('compose/Grid.html.twig', {'cols': '1-2', 'class': og_s(og_cnv(['gap-8', (og_t(og_eq(og_get(v_media, ['align']), 'start')) ? 'items-start' : 'items-center')])), 'children': c_4}, with_context = false) }}
      {%- else %}
        {%- set c_6 -%}
          {{ include('blocks/section-header.html.twig', {'p': {'titleId': v_titleId, 'title': v_title, 'heading': v_heading, 'action': v_action, 'lead': v_lead, 'center': v_center}}, with_context = false) }}
          {{ og_slot((children ?? null))|raw }}
          {%- if og_t(og_get(v_media, ['show'])) %}
            {%- set c_5 -%}
              {{ og_slot((p.aside ?? null))|raw }}
            {%- endset -%}
            {{ include('compose/Box.html.twig', {'class': 'w-full', 'attrs': og_attrs(['data-slot', 'media']), 'children': c_5}, with_context = false) }}
          {%- endif %}
        {%- endset -%}
        {{ include('blocks/section-column.html.twig', {'p': {'measure': v_measure}, 'children': og_markup(c_6)}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('blocks/section-box.html.twig', {'p': {'boxed': v_boxed}, 'children': og_markup(c_7)}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Container.html.twig', {'class': og_s((og_t(og_eq(v_measure, 'landing')) ? og_cnv(['mx-auto w-full px-4', og_preset('blocks/presets/defaults.json', ['section', 'landing'])]) : (og_t(og_eq(v_measure, 'fill')) ? 'w-full' : 'mx-auto w-full max-w-6xl px-4'))), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'class': og_s(og_cnv([og_recipe('blocks/recipes/section-frame.variants.json', {'tone': v_sectionTone, 'density': v_density, 'align': v_align}), (p.className ?? '')])), 'attrs': og_attrs(['aria-labelledby', (og_t(v_landmarkLabel) ? null : (og_t(not (og_eq(v_title, ''))) ? v_titleId : null)), 'aria-label', og_coalesce([v_landmarkLabel, (og_t(og_eq(v_title, '')) ? v_id : null)]), 'data-tone', v_tone, 'data-density', v_density, 'data-slot', 'section']), 'children': c_9}, 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 section-frame
blocks/section-frame.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/patterns/section-frame.json
    A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts the body in a card. Axes: layout, media side, tone, density, align.
    Props (p): id, title, lead, heading, action, layout, media, boxed, tone, density, align, measure, landmarkLabel, className, aside (slot); children: markup. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? '')}
{var $v_lead = ($p['lead'] ?? null)}
{var $v_heading = ($p['heading'] ?? null)}
{var $v_action = ($p['action'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'stack')}
{var $v_media = ($p['media'] ?? null)}
{var $v_boxed = ($p['boxed'] ?? false)}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_align = ($p['align'] ?? 'start')}
{var $v_measure = ($p['measure'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{var $v_titleId = og_add($v_id, '-title')}
{var $v_sectionTone = (og_t($v_boxed) ? 'default' : $v_tone)}
{var $v_center = og_eq($v_align, 'center')}
{capture $c_9}
  {capture $c_8}
    {capture $c_7}
      {if og_t(og_eq($v_layout, 'split'))}
        {capture $c_4}
          {if og_t(og_and([og_get($v_media, ['show']), og_eq(og_get($v_media, ['side']), 'start')]))}
            {capture $c_1}
              {=og_slot(($p['aside'] ?? null))|noescape}
            {/capture}
            {=og_include('compose/Box.latte', ['class' => 'w-full', 'attrs' => og_attrs(['data-slot', 'media']), 'children' => (string) $c_1])|noescape}
          {/if}
          {capture $c_2}
            {=og_include('blocks/section-header.latte', ['p' => ['titleId' => $v_titleId, 'title' => $v_title, 'heading' => $v_heading, 'action' => $v_action, 'lead' => $v_lead, 'center' => $v_center]])|noescape}
            {=og_slot(($children ?? null))|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'children' => (string) $c_2])|noescape}
          {if og_t(og_and([og_get($v_media, ['show']), !(og_eq(og_get($v_media, ['side']), 'start'))]))}
            {capture $c_3}
              {=og_slot(($p['aside'] ?? null))|noescape}
            {/capture}
            {=og_include('compose/Box.latte', ['class' => 'w-full', 'attrs' => og_attrs(['data-slot', 'media']), 'children' => (string) $c_3])|noescape}
          {/if}
        {/capture}
        {=og_include('compose/Grid.latte', ['cols' => '1-2', 'class' => og_s(og_cnv(['gap-8', (og_t(og_eq(og_get($v_media, ['align']), 'start')) ? 'items-start' : 'items-center')])), 'children' => (string) $c_4])|noescape}
      {else}
        {capture $c_6}
          {=og_include('blocks/section-header.latte', ['p' => ['titleId' => $v_titleId, 'title' => $v_title, 'heading' => $v_heading, 'action' => $v_action, 'lead' => $v_lead, 'center' => $v_center]])|noescape}
          {=og_slot(($children ?? null))|noescape}
          {if og_t(og_get($v_media, ['show']))}
            {capture $c_5}
              {=og_slot(($p['aside'] ?? null))|noescape}
            {/capture}
            {=og_include('compose/Box.latte', ['class' => 'w-full', 'attrs' => og_attrs(['data-slot', 'media']), 'children' => (string) $c_5])|noescape}
          {/if}
        {/capture}
        {=og_include('blocks/section-column.latte', ['p' => ['measure' => $v_measure], 'children' => og_markup($c_6)])|noescape}
      {/if}
    {/capture}
    {=og_include('blocks/section-box.latte', ['p' => ['boxed' => $v_boxed], 'children' => og_markup($c_7)])|noescape}
  {/capture}
  {=og_include('compose/Container.latte', ['class' => og_s((og_t(og_eq($v_measure, 'landing')) ? og_cnv(['mx-auto w-full px-4', og_preset('blocks/presets/defaults.json', ['section', 'landing'])]) : (og_t(og_eq($v_measure, 'fill')) ? 'w-full' : 'mx-auto w-full max-w-6xl px-4'))), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'class' => og_s(og_cnv([og_recipe('blocks/recipes/section-frame.variants.json', ['tone' => $v_sectionTone, 'density' => $v_density, 'align' => $v_align]), ($p['className'] ?? '')])), 'attrs' => og_attrs(['aria-labelledby', (og_t($v_landmarkLabel) ? null : (og_t(!(og_eq($v_title, ''))) ? $v_titleId : null)), 'aria-label', og_coalesce([$v_landmarkLabel, (og_t(og_eq($v_title, '')) ? $v_id : null)]), 'data-tone', $v_tone, 'data-density', $v_density, 'data-slot', 'section']), 'children' => (string) $c_9])|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 section-frame
blocks/section-frame.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/patterns/section-frame.json
    A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts the body in a card. Axes: layout, media side, tone, density, align.
    Props (p): id, title, lead, heading, action, layout, media, boxed, tone, density, align, measure, landmarkLabel, className, aside (slot); children: markup. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], '') -%}
{%- set v_lead = og_def(p['lead'], none) -%}
{%- set v_heading = og_def(p['heading'], none) -%}
{%- set v_action = og_def(p['action'], none) -%}
{%- set v_layout = og_def(p['layout'], 'stack') -%}
{%- set v_media = og_def(p['media'], none) -%}
{%- set v_boxed = og_def(p['boxed'], false) -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_align = og_def(p['align'], 'start') -%}
{%- set v_measure = og_def(p['measure'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set v_titleId = og_add(v_id, '-title') -%}
{%- set v_sectionTone = ('default' if og_t(v_boxed) else v_tone) -%}
{%- set v_center = og_eq(v_align, 'center') -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_7 -%}
      {%- if og_t(og_eq(v_layout, 'split')) %}
        {%- set c_4 -%}
          {%- if og_t(og_and([og_get(v_media, ['show']), og_eq(og_get(v_media, ['side']), 'start')])) %}
            {%- set c_1 -%}
              {{ og_slot(og_def(p['aside'], none))|safe }}
            {%- endset -%}
            {{ og_include('compose/box.html.j2', {'p': {'Class': 'w-full', 'Attrs': og_attrs(['data-slot', 'media'])}, 'children': c_1}) }}
          {%- endif %}
          {%- set c_2 -%}
            {{ og_include('blocks/section-header.html.j2', {'p': {'titleId': v_titleId, 'title': v_title, 'heading': v_heading, 'action': v_action, 'lead': v_lead, 'center': v_center}}) }}
            {{ og_slot(og_def(children, none))|safe }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch'}, 'children': c_2}) }}
          {%- if og_t(og_and([og_get(v_media, ['show']), not (og_eq(og_get(v_media, ['side']), 'start'))])) %}
            {%- set c_3 -%}
              {{ og_slot(og_def(p['aside'], none))|safe }}
            {%- endset -%}
            {{ og_include('compose/box.html.j2', {'p': {'Class': 'w-full', 'Attrs': og_attrs(['data-slot', 'media'])}, 'children': c_3}) }}
          {%- endif %}
        {%- endset -%}
        {{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-2', 'Class': og_s(og_cnv(['gap-8', ('items-start' if og_t(og_eq(og_get(v_media, ['align']), 'start')) else 'items-center')]))}, 'children': c_4}) }}
      {%- else %}
        {%- set c_6 -%}
          {{ og_include('blocks/section-header.html.j2', {'p': {'titleId': v_titleId, 'title': v_title, 'heading': v_heading, 'action': v_action, 'lead': v_lead, 'center': v_center}}) }}
          {{ og_slot(og_def(children, none))|safe }}
          {%- if og_t(og_get(v_media, ['show'])) %}
            {%- set c_5 -%}
              {{ og_slot(og_def(p['aside'], none))|safe }}
            {%- endset -%}
            {{ og_include('compose/box.html.j2', {'p': {'Class': 'w-full', 'Attrs': og_attrs(['data-slot', 'media'])}, 'children': c_5}) }}
          {%- endif %}
        {%- endset -%}
        {{ og_include('blocks/section-column.html.j2', {'p': {'measure': v_measure}, 'children': og_markup(c_6)}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('blocks/section-box.html.j2', {'p': {'boxed': v_boxed}, 'children': og_markup(c_7)}) }}
  {%- endset -%}
  {{ og_include('compose/container.html.j2', {'p': {'Class': og_s((og_cnv(['mx-auto w-full px-4', og_preset('blocks/presets/defaults.json', ['section', 'landing'])]) if og_t(og_eq(v_measure, 'landing')) else ('w-full' if og_t(og_eq(v_measure, 'fill')) else 'mx-auto w-full max-w-6xl px-4'))), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Class': og_s(og_cnv([og_recipe('blocks/recipes/section-frame.variants.json', {'tone': v_sectionTone, 'density': v_density, 'align': v_align}), og_def(p['className'], '')])), 'Attrs': og_attrs(['aria-labelledby', (none if og_t(v_landmarkLabel) else (v_titleId if og_t(not (og_eq(v_title, ''))) else none)), 'aria-label', og_coalesce([v_landmarkLabel, (v_id if og_t(og_eq(v_title, '')) else none)]), 'data-tone', v_tone, 'data-density', v_density, 'data-slot', 'section'])}, 'children': c_9}) }}

Jinja2 registry item (JSON)

Props

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

A page section: the landmark named by its heading, the heading (h1 or h2), an optional lead, the body (`children`) and optional media. `layout` stacks everything or puts the media beside the text; `boxed` puts the body in a card. Axes: layout, media side, tone, density, align.

Props of SectionFrame
PropTypeDefault Description
id (required)string-ties the heading to the section: the heading id is `<id>-title`
title string""section heading; empty string: no heading
lead string-text under the heading
heading SectionHeading-how the heading is drawn: its level, its scale, a badge above it
action HeadLink-optional link opposite the heading
layout "stack" | "split""stack"stack: media below the body; split: media beside it
media SectionMedia-the `aside` slot: shown or not, and its side
boxed booleanfalsethe body sits in a card
tone "default" | "muted" | "inverse""default"background
density "roomy" | "default" | "compact" | "flush""default"vertical padding
align "start" | "center""start"text alignment
measure "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl""default"default: max-w-6xl; landing: the landing column of the preset; fill: full width of parent; xs to 3xl: a narrow body, the heading and the body one column of that width centred in the default container
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one

Used in