Feature Sticky
A picture that stays in view beside a list of features. Following the section being read is a port contract (ScrollSpy).
Install
npx ui8kit add feature-stickyPulls in: box, compose, empty-state, feature-grid, grid, kit-box, kit-text, lucide-icon, media-frame, section-frame, stack, text, title, utils
Preview
Follow the story
Fast by default
Pages render from static data and ship little script.
Clear structure
One heading per page, landmarks and a skip link come built in.
Safe forms
Inputs carry labels and errors are announced to assistive tools.
Ready for any language
Every text lives in a dictionary, so a new language is one more file.
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add feature-sticky<!-- 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 picture that stays in view while the feature descriptions scroll beside it. `active` marks the description
that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item
(plain, card), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Feature } from "./feature-grid.types";
export type FeatureStickyProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
active?: string;
mediaSide?: "end" | "start";
item?: "plain" | "card";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Grid from "../compose/Grid.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
import EmptyState from "../components/empty-state.svelte";
import MediaFrame from "../components/media-frame.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { cn } from "../utils";
let {
id,
title,
features,
empty = "",
active = "",
mediaSide = "end",
item = "plain",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureStickyProps = $props();
</script>
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{#if ((features?.length ?? 0) === 0)}
<EmptyState icon="layout-grid" title={empty} />
{:else}
<Grid cols="1-2" class="items-start gap-8" data-slot="sticky">
<Box
class={cn(
"md:sticky md:top-8",
(((mediaSide as string) === "start") ? "md:order-first" : "md:order-last")
)}
data-slot="sticky-media"
>
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
</Box>
<Stack gap={(((density as string) === "compact") ? "4" : "8")} align="stretch" data-slot="items">
{#each features as f (f.id)}
<Stack
gap="2"
class={cn(
(((item as string) === "card") ? "rounded bg-card inset-ring inset-ring-border p-6" : "py-4"),
((f.id === active) ? "inset-ring inset-ring-foreground" : "")
)}
aria-current={((f.id === active) ? "true" : undefined)}
data-slot="item"
>
<LucideIcon name={f.icon} size={24} />
<Title as={3} size="2xl" weight="bold">
{f.title}
</Title>
<Text size="base" class="text-muted-foreground">
{f.text}
</Text>
</Stack>
{/each}
</Stack>
</Grid>
{/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 feature-sticky// 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 picture that stays in view while the feature descriptions scroll beside it. `active` marks the description
* that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item
* (plain, card), tone, density.
*/
import { type ReactNode } from "react";
import { Box, Grid, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Feature } from "./feature-grid.types";
export type FeatureStickyProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
active?: string;
mediaSide?: "end" | "start";
item?: "plain" | "card";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function FeatureSticky({
id,
title,
features,
empty = "",
active = "",
mediaSide = "end",
item = "plain",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureStickyProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Grid cols="1-2" className="items-start gap-8" data-slot="sticky">
<Box
className={cn(
"md:sticky md:top-8",
(((mediaSide as string) === "start") ? "md:order-first" : "md:order-last")
)}
data-slot="sticky-media"
>
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
</Box>
<Stack gap={(((density as string) === "compact") ? "4" : "8")} align="stretch" data-slot="items">
{(features ?? []).map((f) => (
<Stack key={f.id}
gap="2"
className={cn(
(((item as string) === "card") ? "rounded bg-card inset-ring inset-ring-border p-6" : "py-4"),
((f.id === active) ? "inset-ring inset-ring-foreground" : "")
)}
aria-current={((f.id === active) ? "true" : undefined)}
data-slot="item"
>
<LucideIcon name={f.icon} size={24} />
<Title as={3} size="2xl" weight="bold">
{f.title}
</Title>
<Text size="base" className="text-muted-foreground">
{f.text}
</Text>
</Stack>
))}
</Stack>
</Grid>
)}
</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 feature-sticky<!-- 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 picture that stays in view while the feature descriptions scroll beside it. `active` marks the description
that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item
(plain, card), tone, density.
-->
<script lang="ts">
import type { Feature } from "./feature-grid.types";
export type FeatureStickyProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
active?: string;
mediaSide?: "end" | "start";
item?: "plain" | "card";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Grid from "../compose/Grid.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn } from "../utils";
const {
id,
title,
features,
empty = "",
active = "",
mediaSide = "end",
item = "plain",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
} = defineProps<FeatureStickyProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :tone="tone" :density="density" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((features?.length ?? 0) === 0)" icon="layout-grid" :title="empty" />
<Grid v-else cols="1-2" class="items-start gap-8" data-slot="sticky">
<Box
:class="cn(
'md:sticky md:top-8',
(((mediaSide as string) === 'start') ? 'md:order-first' : 'md:order-last')
)"
data-slot="sticky-media"
>
<MediaFrame :alt="(imageAlt ? imageAlt : title)" :src="image" ratio="4/3" />
</Box>
<Stack :gap="(((density as string) === 'compact') ? '4' : '8')" align="stretch" data-slot="items">
<Stack v-for="f in features" :key="f.id"
gap="2"
:class="cn(
(((item as string) === 'card') ? 'rounded bg-card inset-ring inset-ring-border p-6' : 'py-4'),
((f.id === active) ? 'inset-ring inset-ring-foreground' : '')
)"
:aria-current="((f.id === active) ? 'true' : undefined)"
data-slot="item"
>
<LucideIcon :name="f.icon" :size="24" />
<Title :as="3" size="2xl" weight="bold">
{{ f.title }}
</Title>
<Text size="base" class="text-muted-foreground">
{{ f.text }}
</Text>
</Stack>
</Stack>
</Grid>
</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 feature-sticky// 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 picture that stays in view while the feature descriptions scroll beside it. `active` marks the description
* that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item
* (plain, card), tone, density.
*/
import { For, type JSX } from "solid-js";
import { Box, Grid, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Feature } from "./feature-grid.types";
export type FeatureStickyProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
active?: string;
mediaSide?: "end" | "start";
item?: "plain" | "card";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function FeatureSticky({
id,
title,
features,
empty = "",
active = "",
mediaSide = "end",
item = "plain",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureStickyProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Grid cols="1-2" class="items-start gap-8" data-slot="sticky">
<Box
class={cn(
"md:sticky md:top-8",
(((mediaSide as string) === "start") ? "md:order-first" : "md:order-last")
)}
data-slot="sticky-media"
>
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
</Box>
<Stack gap={(((density as string) === "compact") ? "4" : "8")} align="stretch" data-slot="items">
<For each={features ?? []}>{(f) => (
<Stack
gap="2"
class={cn(
(((item as string) === "card") ? "rounded bg-card inset-ring inset-ring-border p-6" : "py-4"),
((f.id === active) ? "inset-ring inset-ring-foreground" : "")
)}
aria-current={((f.id === active) ? "true" : undefined)}
data-slot="item"
>
<LucideIcon name={f.icon} size={24} />
<Title as={3} size="2xl" weight="bold">
{f.title}
</Title>
<Text size="base" class="text-muted-foreground">
{f.text}
</Text>
</Stack>
)}</For>
</Stack>
</Grid>
)}
</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 feature-sticky// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/feature-sticky.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// FeatureStickyProps are the props of FeatureSticky; the values are the JSON shapes of the TypeScript props.
type FeatureStickyProps struct {
Id any `json:"id"`
Title any `json:"title"`
Features any `json:"features"`
Empty any `json:"empty"`
Active any `json:"active"`
MediaSide any `json:"mediaSide"`
Item any `json:"item"`
Tone any `json:"tone"`
Density any `json:"density"`
Image any `json:"image"`
ImageAlt any `json:"imageAlt"`
LandmarkLabel any `json:"landmarkLabel"`
}
// A picture that stays in view while the feature descriptions scroll beside it. `active` marks the description that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item (plain, card), tone, density.
templ FeatureSticky(p FeatureStickyProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vFeatures := p.Features }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vActive := uiutils.Def(p.Active, "") }}
{{ vMediaSide := uiutils.Def(p.MediaSide, "end") }}
{{ vItem := uiutils.Def(p.Item, "plain") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vImage := p.Image }}
{{ vImageAlt := p.ImageAlt }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vFeatures), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "layout-grid", Title: vEmpty})
} else {
@compose.Grid(compose.GridProps{Cols: "1-2", BoxProps: box.BoxProps{Class: "items-start gap-8", Attrs: uiutils.Attrs("data-slot", "sticky")}}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("md:sticky md:top-8", uiutils.Cond(uiutils.T(uiutils.Eq(vMediaSide, "start")), "md:order-first", "md:order-last"))), Attrs: uiutils.Attrs("data-slot", "sticky-media")}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: "4/3"})
}
@compose.Stack(compose.StackProps{Gap: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "4", "8")), Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vF := range uiutils.L(vFeatures) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vItem, "card")), "rounded bg-card inset-ring inset-ring-border p-6", "py-4"), uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vF, "id"), vActive)), "inset-ring inset-ring-foreground", ""))), Attrs: uiutils.Attrs("aria-current", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vF, "id"), vActive)), "true", nil), "data-slot", "item")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vF, "icon")), Size: 24})
@compose.Title(compose.TitleProps{As: "3", Size: "2xl", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vF, "title")) }
}
@compose.Text(compose.TextProps{Size: "base", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vF, "text")) }
}
}
}
}
}
}
}
}
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 feature-sticky{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/feature-sticky.json
A picture that stays in view while the feature descriptions scroll beside it. `active` marks the description that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item (plain, card), tone, density.
Props (p): id, title, features, empty, active, mediaSide, item, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_features = (p.features ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_active = (p.active ?? '') -%}
{%- set v_mediaSide = (p.mediaSide ?? 'end') -%}
{%- set v_item = (p.item ?? 'plain') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_7 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layout-grid', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_6 -%}
{%- set c_1 -%}
{{ 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) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['md:sticky md:top-8', (og_t(og_eq(v_mediaSide, 'start')) ? 'md:order-first' : 'md:order-last')])), 'attrs': og_attrs(['data-slot', 'sticky-media']), 'children': c_1}, with_context = false) }}
{%- set c_5 -%}
{%- for v_f in og_l(v_features) %}
{%- set c_4 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_f, ['icon'])), 'size': 24}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': '2xl', 'weight': 'bold', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': og_s(og_cnv([(og_t(og_eq(v_item, 'card')) ? 'rounded bg-card inset-ring inset-ring-border p-6' : 'py-4'), (og_t(og_eq(og_get(v_f, ['id']), v_active)) ? 'inset-ring inset-ring-foreground' : '')])), 'attrs': og_attrs(['aria-current', (og_t(og_eq(og_get(v_f, ['id']), v_active)) ? 'true' : null), 'data-slot', 'item']), 'children': c_4}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': og_s((og_t(og_eq(v_density, 'compact')) ? '4' : '8')), 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-2', 'class': 'items-start gap-8', 'attrs': og_attrs(['data-slot', 'sticky']), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}, 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 feature-sticky{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/feature-sticky.json
A picture that stays in view while the feature descriptions scroll beside it. `active` marks the description that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item (plain, card), tone, density.
Props (p): id, title, features, empty, active, mediaSide, item, tone, density, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_features = ($p['features'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_active = ($p['active'] ?? '')}
{var $v_mediaSide = ($p['mediaSide'] ?? 'end')}
{var $v_item = ($p['item'] ?? 'plain')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_7}
{if og_t(og_eq(og_len($v_features), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layout-grid', 'title' => $v_empty]])|noescape}
{else}
{capture $c_6}
{capture $c_1}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => '4/3']])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['md:sticky md:top-8', (og_t(og_eq($v_mediaSide, 'start')) ? 'md:order-first' : 'md:order-last')])), 'attrs' => og_attrs(['data-slot', 'sticky-media']), 'children' => (string) $c_1])|noescape}
{capture $c_5}
{foreach og_l($v_features) as $v_f}
{capture $c_4}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_f, ['icon'])), 'size' => 24])|noescape}
{capture $c_2}
{=og_text(og_get($v_f, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => '2xl', 'weight' => 'bold', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_f, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => og_s(og_cnv([(og_t(og_eq($v_item, 'card')) ? 'rounded bg-card inset-ring inset-ring-border p-6' : 'py-4'), (og_t(og_eq(og_get($v_f, ['id']), $v_active)) ? 'inset-ring inset-ring-foreground' : '')])), 'attrs' => og_attrs(['aria-current', (og_t(og_eq(og_get($v_f, ['id']), $v_active)) ? 'true' : null), 'data-slot', 'item']), 'children' => (string) $c_4])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => og_s((og_t(og_eq($v_density, 'compact')) ? '4' : '8')), 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-2', 'class' => 'items-start gap-8', 'attrs' => og_attrs(['data-slot', 'sticky']), 'children' => (string) $c_6])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_7)])|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 feature-sticky{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/feature-sticky.json
A picture that stays in view while the feature descriptions scroll beside it. `active` marks the description that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item (plain, card), tone, density.
Props (p): id, title, features, empty, active, mediaSide, item, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_active = og_def(p['active'], '') -%}
{%- set v_mediaSide = og_def(p['mediaSide'], 'end') -%}
{%- set v_item = og_def(p['item'], 'plain') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_imageAlt = og_def(p['imageAlt'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_7 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layout-grid', 'title': v_empty}}) }}
{%- else %}
{%- set c_6 -%}
{%- set c_1 -%}
{{ 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'}}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['md:sticky md:top-8', ('md:order-first' if og_t(og_eq(v_mediaSide, 'start')) else 'md:order-last')])), 'Attrs': og_attrs(['data-slot', 'sticky-media'])}, 'children': c_1}) }}
{%- set c_5 -%}
{%- for v_f in og_l(v_features) %}
{%- set c_4 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_f, ['icon'])), 'Size': 24}}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': '2xl', 'Weight': 'bold'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': og_s(og_cnv([('rounded bg-card inset-ring inset-ring-border p-6' if og_t(og_eq(v_item, 'card')) else 'py-4'), ('inset-ring inset-ring-foreground' if og_t(og_eq(og_get(v_f, ['id']), v_active)) else '')])), 'Attrs': og_attrs(['aria-current', ('true' if og_t(og_eq(og_get(v_f, ['id']), v_active)) else none), 'data-slot', 'item'])}, 'children': c_4}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': og_s(('4' if og_t(og_eq(v_density, 'compact')) else '8')), 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-2', 'Class': 'items-start gap-8', 'Attrs': og_attrs(['data-slot', 'sticky'])}, 'children': c_6}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}) }}
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 picture that stays in view while the feature descriptions scroll beside it. `active` marks the description that is current (the page follows the scroll; that is a port contract). Axes: mediaSide (end, start), item (plain, card), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| features (required) | Feature[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| active | string | "" | id of the current feature |
| mediaSide | "end" | "start" | "end" | |
| item | "plain" | "card" | "plain" | |
| tone | "default" | "muted" | "default" | |
| density | "default" | "compact" | "default" | |
| image | string | - | address of the picture (an https URL or a path); none: the placeholder |
| imageAlt | string | - | alt text of the picture; none: the title |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |