Page Intro
The head of an inner page: the heading, one sentence and an optional action.
Install
npx ui8kit add page-introPulls in: action-group, section-frame, utils
Preview
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add page-intro<!-- 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 head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action.
Axes: align (start, center), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type PageIntroProps = {
id: string;
title: string;
text: string;
cta?: string;
href?: string;
level?: 1 | 2;
align?: "start" | "center";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import ActionGroup from "../components/action-group.svelte";
import SectionFrame from "../components/section-frame.svelte";
let {
id,
title,
text,
cta,
href,
level = 1,
align = "start",
tone = "default",
density = "default",
landmarkLabel,
}: PageIntroProps = $props();
</script>
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
align={align}
tone={tone}
density={density}
landmarkLabel={landmarkLabel}
>
{#if cta}
<ActionGroup primary={cta} primaryHref={href} align={align} />
{/if}
</SectionFrame>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdnnpx ui8kit add page-intro// 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 head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action.
* Axes: align (start, center), tone, density.
*/
import { type ReactNode } from "react";
import { ActionGroup } from "../components/action-group";
import { SectionFrame } from "../components/section-frame";
export type PageIntroProps = {
id: string;
title: string;
text: string;
cta?: string;
href?: string;
level?: 1 | 2;
align?: "start" | "center";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function PageIntro({
id,
title,
text,
cta,
href,
level = 1,
align = "start",
tone = "default",
density = "default",
landmarkLabel,
}: PageIntroProps) {
return (
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
align={align}
tone={tone}
density={density}
landmarkLabel={landmarkLabel}
>
{cta ? (
<ActionGroup primary={cta} primaryHref={href} align={align} />
) : null}
</SectionFrame>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdnnpx ui8kit add page-intro<!-- 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 head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action.
Axes: align (start, center), tone, density.
-->
<script lang="ts">
export type PageIntroProps = {
id: string;
title: string;
text: string;
cta?: string;
href?: string;
level?: 1 | 2;
align?: "start" | "center";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import ActionGroup from "../components/action-group.vue";
import SectionFrame from "../components/section-frame.vue";
const {
id,
title,
text,
cta,
href,
level = 1,
align = "start",
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<PageIntroProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:lead="text"
:heading="{ level }"
:align="align"
:tone="tone"
:density="density"
:landmarkLabel="landmarkLabel"
>
<ActionGroup v-if="cta" :primary="cta" :primaryHref="href" :align="align" />
</SectionFrame>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add page-intro// 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 head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action.
* Axes: align (start, center), tone, density.
*/
import { type JSX } from "solid-js";
import { ActionGroup } from "../components/action-group";
import { SectionFrame } from "../components/section-frame";
export type PageIntroProps = {
id: string;
title: string;
text: string;
cta?: string;
href?: string;
level?: 1 | 2;
align?: "start" | "center";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function PageIntro({
id,
title,
text,
cta,
href,
level = 1,
align = "start",
tone = "default",
density = "default",
landmarkLabel,
}: PageIntroProps) {
return (
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
align={align}
tone={tone}
density={density}
landmarkLabel={landmarkLabel}
>
{cta ? (
<ActionGroup primary={cta} primaryHref={href} align={align} />
) : null}
</SectionFrame>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdnnpx ui8kit add page-intro// 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/page-intro.json
package blocks
import (
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// PageIntroProps are the props of PageIntro; the values are the JSON shapes of the TypeScript props.
type PageIntroProps struct {
Id any `json:"id"`
Title any `json:"title"`
Text any `json:"text"`
Cta any `json:"cta"`
Href any `json:"href"`
Level any `json:"level"`
Align any `json:"align"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action. Axes: align (start, center), tone, density.
templ PageIntro(p PageIntroProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vText := p.Text }}
{{ vCta := p.Cta }}
{{ vHref := p.Href }}
{{ vLevel := uiutils.Def(p.Level, float64(1)) }}
{{ vAlign := uiutils.Def(p.Align, "start") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vText, Heading: map[string]any{"level": vLevel}, Align: vAlign, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
if uiutils.T(vCta) {
@ActionGroup(ActionGroupProps{Primary: vCta, PrimaryHref: vHref, Align: vAlign})
}
}
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdnnpx ui8kit add page-intro{#- 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/page-intro.json
The head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action. Axes: align (start, center), tone, density.
Props (p): id, title, text, cta, href, level, align, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_cta = (p.cta ?? null) -%}
{%- set v_href = (p.href ?? null) -%}
{%- set v_level = (p.level ?? 1) -%}
{%- set v_align = (p.align ?? 'start') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_1 -%}
{%- if og_t(v_cta) %}
{{ include('blocks/action-group.html.twig', {'p': {'primary': v_cta, 'primaryHref': v_href, 'align': v_align}}, 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}, 'align': v_align, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_1)}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add page-intro{* 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/page-intro.json
The head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action. Axes: align (start, center), tone, density.
Props (p): id, title, text, cta, href, level, align, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_cta = ($p['cta'] ?? null)}
{var $v_href = ($p['href'] ?? null)}
{var $v_level = ($p['level'] ?? 1)}
{var $v_align = ($p['align'] ?? 'start')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_1}
{if og_t($v_cta)}
{=og_include('blocks/action-group.latte', ['p' => ['primary' => $v_cta, 'primaryHref' => $v_href, 'align' => $v_align]])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_text, 'heading' => ['level' => $v_level], 'align' => $v_align, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_1)])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add page-intro{#- 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/page-intro.json
The head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action. Axes: align (start, center), tone, density.
Props (p): id, title, text, cta, href, level, align, tone, density, 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_cta = og_def(p['cta'], none) -%}
{%- set v_href = og_def(p['href'], none) -%}
{%- set v_level = og_def(p['level'], 1) -%}
{%- set v_align = og_def(p['align'], 'start') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_1 -%}
{%- if og_t(v_cta) %}
{{ og_include('blocks/action-group.html.j2', {'p': {'primary': v_cta, 'primaryHref': v_href, 'align': v_align}}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'heading': {'level': v_level}, 'align': v_align, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_1)}) }}
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 head of an inner page: the heading (h1 on a page of its own), one sentence and, optionally, an action. Axes: align (start, center), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| text (required) | string | - | |
| cta | string | - | |
| href | string | - | |
| level | 1 | 2 | 1 | |
| align | "start" | "center" | "start" | |
| tone | "default" | "muted" | "default" | |
| density | "default" | "compact" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |