Milestone Timeline
Milestones on a vertical line beside a picture, in a narrow column, or in a row.
Install
npx ui8kit add milestone-timelinePulls in: badge, compose, empty-state, group, inline, kit-box, kit-text, list, list-item, media-frame, section-frame, text, title, utils
Preview
Our story so far
From a list of blocks to a kit in eight runtimes.
2021
StartThe first commit
Two people, one laptop and a list of blocks they kept rebuilding.
2022
ReleasePublic launch
The kit goes public with forty blocks and one runtime.
2024
ReleaseThree runtimes
Svelte, React and Vue from the same specs, file for file.
2026
TeamA team of twenty
Offices in three cities and a support desk that answers within the hour.
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 milestone-timeline<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line
beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone,
density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Milestone } from "./milestone-timeline.types";
export type MilestoneTimelineProps = {
id: string;
title: string;
lead?: string;
milestones: Milestone[];
empty?: string;
layout?: "split" | "stacked" | "row";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.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";
let {
id,
title,
lead = "",
milestones,
empty = "",
layout = "split",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: MilestoneTimelineProps = $props();
</script>
<SectionFrame
id={id}
title={title}
lead={lead}
tone={tone}
density={density}
layout={(((layout as string) === "split") ? "split" : "stack")}
media={{ show: ((layout as string) === "split"), side: "start", align: "start" }}
measure={(((layout as string) === "stacked") ? "2xl" : "default")}
landmarkLabel={landmarkLabel}
>
{#if ((milestones?.length ?? 0) === 0)}
<EmptyState icon="milestone" title={empty} />
{:else}
<List
tag="ol"
class={
(layout as string) === "row" ? "grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4"
: "flex flex-col gap-8 border-l border-border"
}
data-slot="items"
>
{#each milestones as m (m.id)}
<ListItem
class={
(layout as string) === "row" ? "relative flex flex-col gap-2 pt-6"
: "relative flex flex-col gap-2 pl-6"
}
data-slot="item"
>
<Inline
class={
(layout as string) === "row" ? "absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary"
: "absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary"
}
aria-hidden="true"
/>
<Group gap="2" align="center">
<Text size="sm" weight="semibold">
{m.date}
</Text>
<Badge variant="outline" size="sm">
{m.tag}
</Badge>
</Group>
<Title as={3} size="lg" weight="bold">
{m.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{m.text}
</Text>
</ListItem>
{/each}
</List>
{/if}
{#snippet aside()}
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="3/4" />
{/snippet}
</SectionFrame>
// 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 Milestone = {
id: string;
date: string;
title: string;
text: string;
tag: string;
};
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 milestone-timeline// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line
* beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone,
* density.
*/
import { type ReactNode } from "react";
import { Badge, Group, Inline, List, ListItem, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import type { Milestone } from "./milestone-timeline.types";
export type MilestoneTimelineProps = {
id: string;
title: string;
lead?: string;
milestones: Milestone[];
empty?: string;
layout?: "split" | "stacked" | "row";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function MilestoneTimeline({
id,
title,
lead = "",
milestones,
empty = "",
layout = "split",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: MilestoneTimelineProps) {
return (
<SectionFrame
id={id}
title={title}
lead={lead}
tone={tone}
density={density}
layout={(((layout as string) === "split") ? "split" : "stack")}
media={{ show: ((layout as string) === "split"), side: "start", align: "start" }}
measure={(((layout as string) === "stacked") ? "2xl" : "default")}
landmarkLabel={landmarkLabel}
aside={(
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="3/4" />
)}
>
{((milestones?.length ?? 0) === 0) ? (
<EmptyState icon="milestone" title={empty} />
) : (
<List
tag="ol"
className={
(layout as string) === "row" ? "grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4"
: "flex flex-col gap-8 border-l border-border"
}
data-slot="items"
>
{(milestones ?? []).map((m) => (
<ListItem key={m.id}
className={
(layout as string) === "row" ? "relative flex flex-col gap-2 pt-6"
: "relative flex flex-col gap-2 pl-6"
}
data-slot="item"
>
<Inline
className={
(layout as string) === "row" ? "absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary"
: "absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary"
}
aria-hidden="true"
/>
<Group gap="2" align="center">
<Text size="sm" weight="semibold">
{m.date}
</Text>
<Badge variant="outline" size="sm">
{m.tag}
</Badge>
</Group>
<Title as={3} size="lg" weight="bold">
{m.title}
</Title>
<Text size="sm" className="text-muted-foreground">
{m.text}
</Text>
</ListItem>
))}
</List>
)}
</SectionFrame>
);
}
// 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 Milestone = {
id: string;
date: string;
title: string;
text: string;
tag: string;
};
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 milestone-timeline// 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 Milestone = {
id: string;
date: string;
title: string;
text: string;
tag: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line
beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone,
density.
-->
<script lang="ts">
import type { Milestone } from "./milestone-timeline.types";
export type MilestoneTimelineProps = {
id: string;
title: string;
lead?: string;
milestones: Milestone[];
empty?: string;
layout?: "split" | "stacked" | "row";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.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";
const {
id,
title,
lead = "",
milestones,
empty = "",
layout = "split",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
} = defineProps<MilestoneTimelineProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:lead="lead"
:tone="tone"
:density="density"
:layout="(((layout as string) === 'split') ? 'split' : 'stack')"
:media="{ show: ((layout as string) === 'split'), side: 'start', align: 'start' }"
:measure="(((layout as string) === 'stacked') ? '2xl' : 'default')"
:landmarkLabel="landmarkLabel"
>
<EmptyState v-if="((milestones?.length ?? 0) === 0)" icon="milestone" :title="empty" />
<List v-else
tag="ol"
:class="
(layout as string) === 'row' ? 'grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4'
: 'flex flex-col gap-8 border-l border-border'
"
data-slot="items"
>
<ListItem v-for="m in milestones" :key="m.id"
:class="
(layout as string) === 'row' ? 'relative flex flex-col gap-2 pt-6'
: 'relative flex flex-col gap-2 pl-6'
"
data-slot="item"
>
<Inline
:class="
(layout as string) === 'row' ? 'absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary'
: 'absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary'
"
aria-hidden="true"
/>
<Group gap="2" align="center">
<Text size="sm" weight="semibold">
{{ m.date }}
</Text>
<Badge variant="outline" size="sm">
{{ m.tag }}
</Badge>
</Group>
<Title :as="3" size="lg" weight="bold">
{{ m.title }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ m.text }}
</Text>
</ListItem>
</List>
<template #aside>
<MediaFrame :alt="(imageAlt ? imageAlt : title)" :src="image" ratio="3/4" />
</template>
</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 milestone-timeline// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line
* beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone,
* density.
*/
import { For, type JSX } from "solid-js";
import { Badge, Group, Inline, List, ListItem, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import type { Milestone } from "./milestone-timeline.types";
export type MilestoneTimelineProps = {
id: string;
title: string;
lead?: string;
milestones: Milestone[];
empty?: string;
layout?: "split" | "stacked" | "row";
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function MilestoneTimeline({
id,
title,
lead = "",
milestones,
empty = "",
layout = "split",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: MilestoneTimelineProps) {
return (
<SectionFrame
id={id}
title={title}
lead={lead}
tone={tone}
density={density}
layout={(((layout as string) === "split") ? "split" : "stack")}
media={{ show: ((layout as string) === "split"), side: "start", align: "start" }}
measure={(((layout as string) === "stacked") ? "2xl" : "default")}
landmarkLabel={landmarkLabel}
aside={(
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="3/4" />
)}
>
{((milestones?.length ?? 0) === 0) ? (
<EmptyState icon="milestone" title={empty} />
) : (
<List
tag="ol"
class={
(layout as string) === "row" ? "grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4"
: "flex flex-col gap-8 border-l border-border"
}
data-slot="items"
>
<For each={milestones ?? []}>{(m) => (
<ListItem
class={
(layout as string) === "row" ? "relative flex flex-col gap-2 pt-6"
: "relative flex flex-col gap-2 pl-6"
}
data-slot="item"
>
<Inline
class={
(layout as string) === "row" ? "absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary"
: "absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary"
}
aria-hidden="true"
/>
<Group gap="2" align="center">
<Text size="sm" weight="semibold">
{m.date}
</Text>
<Badge variant="outline" size="sm">
{m.tag}
</Badge>
</Group>
<Title as={3} size="lg" weight="bold">
{m.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{m.text}
</Text>
</ListItem>
)}</For>
</List>
)}
</SectionFrame>
);
}
// 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 Milestone = {
id: string;
date: string;
title: string;
text: string;
tag: string;
};
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 milestone-timeline// 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/milestone-timeline.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/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// MilestoneTimelineProps are the props of MilestoneTimeline; the values are the JSON shapes of the TypeScript props.
type MilestoneTimelineProps struct {
Id any `json:"id"`
Title any `json:"title"`
Lead any `json:"lead"`
Milestones any `json:"milestones"`
Empty any `json:"empty"`
Layout any `json:"layout"`
Tone any `json:"tone"`
Density any `json:"density"`
Image any `json:"image"`
ImageAlt any `json:"imageAlt"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone, density.
templ MilestoneTimeline(p MilestoneTimelineProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vLead := uiutils.Def(p.Lead, "") }}
{{ vMilestones := p.Milestones }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vLayout := uiutils.Def(p.Layout, "split") }}
{{ 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, Lead: vLead, Tone: vTone, Density: vDensity, Layout: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "split", "stack"), Media: map[string]any{"show": uiutils.Eq(vLayout, "split"), "side": "start", "align": "start"}, Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stacked")), "2xl", "default"), LandmarkLabel: vLandmarkLabel, Aside: milestoneTimelineFill1(p, vTitle, vImage, vImageAlt)}) {
if uiutils.Eq(uiutils.Len(vMilestones), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "milestone", Title: vEmpty})
} else {
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ol", Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "row")), "grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4", "flex flex-col gap-8 border-l border-border")), Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vM := range uiutils.L(vMilestones) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "row")), "relative flex flex-col gap-2 pt-6", "relative flex flex-col gap-2 pl-6")), Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "row")), "absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary", "absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary")), Attrs: uiutils.Attrs("aria-hidden", "true")}})
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vM, "date")) }
}
@compose.Badge(compose.BadgeProps{Variant: "outline", Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vM, "tag")) }
}
}
@compose.Title(compose.TitleProps{As: "3", Size: "lg", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vM, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vM, "text")) }
}
}
}
}
}
}
}
templ milestoneTimelineFill1(p MilestoneTimelineProps, vTitle any, vImage any, vImageAlt any) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: "3/4"})
}
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 milestone-timeline{#- 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/milestone-timeline.json
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone, density.
Props (p): id, title, lead, milestones, empty, layout, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_milestones = (p.milestones ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_layout = (p.layout ?? 'split') -%}
{%- 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 f_8 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image, 'ratio': '3/4'}}, with_context = false) }}
{%- endset -%}
{%- set c_9 -%}
{%- if og_t(og_eq(og_len(v_milestones), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'milestone', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_7 -%}
{%- for v_m in og_l(v_milestones) %}
{%- set c_6 -%}
{{ include('compose/Inline.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'row')) ? 'absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary' : 'absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary')), 'attrs': og_attrs(['aria-hidden', 'true'])}, with_context = false) }}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_m, ['date'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_m, ['tag'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'outline', 'size': 'sm', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_m, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'lg', 'weight': 'bold', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_m, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'row')) ? 'relative flex flex-col gap-2 pt-6' : 'relative flex flex-col gap-2 pl-6')), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_6}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'tag': 'ol', 'class': og_s((og_t(og_eq(v_layout, 'row')) ? 'grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4' : 'flex flex-col gap-8 border-l border-border')), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_7}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'density': v_density, 'layout': (og_t(og_eq(v_layout, 'split')) ? 'split' : 'stack'), 'media': {'show': og_eq(v_layout, 'split'), 'side': 'start', 'align': 'start'}, 'measure': (og_t(og_eq(v_layout, 'stacked')) ? '2xl' : 'default'), 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_8)}, 'children': og_markup(c_9)}, 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 milestone-timeline{* 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/milestone-timeline.json
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone, density.
Props (p): id, title, lead, milestones, empty, layout, tone, density, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_milestones = ($p['milestones'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_layout = ($p['layout'] ?? 'split')}
{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 $f_8}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => '3/4']])|noescape}
{/capture}
{capture $c_9}
{if og_t(og_eq(og_len($v_milestones), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'milestone', 'title' => $v_empty]])|noescape}
{else}
{capture $c_7}
{foreach og_l($v_milestones) as $v_m}
{capture $c_6}
{=og_include('compose/Inline.latte', ['class' => og_s((og_t(og_eq($v_layout, 'row')) ? 'absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary' : 'absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary')), 'attrs' => og_attrs(['aria-hidden', 'true'])])|noescape}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_m, ['date']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_m, ['tag']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'outline', 'size' => 'sm', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_get($v_m, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'lg', 'weight' => 'bold', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_get($v_m, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => og_s((og_t(og_eq($v_layout, 'row')) ? 'relative flex flex-col gap-2 pt-6' : 'relative flex flex-col gap-2 pl-6')), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_6])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['tag' => 'ol', 'class' => og_s((og_t(og_eq($v_layout, 'row')) ? 'grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4' : 'flex flex-col gap-8 border-l border-border')), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_7])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'tone' => $v_tone, 'density' => $v_density, 'layout' => (og_t(og_eq($v_layout, 'split')) ? 'split' : 'stack'), 'media' => ['show' => og_eq($v_layout, 'split'), 'side' => 'start', 'align' => 'start'], 'measure' => (og_t(og_eq($v_layout, 'stacked')) ? '2xl' : 'default'), 'landmarkLabel' => $v_landmarkLabel, 'aside' => og_markup($f_8)], 'children' => og_markup($c_9)])|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 milestone-timeline{#- 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/milestone-timeline.json
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone, density.
Props (p): id, title, lead, milestones, empty, layout, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_milestones = og_def(p['milestones'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_layout = og_def(p['layout'], 'split') -%}
{%- 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 f_8 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'src': v_image, 'ratio': '3/4'}}) }}
{%- endset -%}
{%- set c_9 -%}
{%- if og_t(og_eq(og_len(v_milestones), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'milestone', 'title': v_empty}}) }}
{%- else %}
{%- set c_7 -%}
{%- for v_m in og_l(v_milestones) %}
{%- set c_6 -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': og_s(('absolute top-0 left-0 size-2 -translate-y-1/2 rounded bg-primary' if og_t(og_eq(v_layout, 'row')) else 'absolute top-2 left-0 size-2 -translate-x-1/2 rounded bg-primary')), 'Attrs': og_attrs(['aria-hidden', 'true'])}}) }}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_m, ['date'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_m, ['tag'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_m, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'lg', 'Weight': 'bold'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_m, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': og_s(('relative flex flex-col gap-2 pt-6' if og_t(og_eq(v_layout, 'row')) else 'relative flex flex-col gap-2 pl-6')), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_6}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Tag': 'ol', 'Class': og_s(('grid grid-cols-1 gap-8 border-t border-border sm:grid-cols-2 lg:grid-cols-4' if og_t(og_eq(v_layout, 'row')) else 'flex flex-col gap-8 border-l border-border')), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_7}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'density': v_density, 'layout': ('split' if og_t(og_eq(v_layout, 'split')) else 'stack'), 'media': {'show': og_eq(v_layout, 'split'), 'side': 'start', 'align': 'start'}, 'measure': ('2xl' if og_t(og_eq(v_layout, 'stacked')) else 'default'), 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_8)}, 'children': og_markup(c_9)}) }}
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.
Milestones on a line: the year, a tag, a title and a sentence each. Axes: layout (split: a vertical line beside a picture, stacked: a vertical line in a narrow column, row: a horizontal line of columns), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| lead | string | "" | |
| milestones (required) | Milestone[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| layout | "split" | "stacked" | "row" | "split" | |
| 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 |