Project Tiles
Project Tiles component
Install
npx ui8kit add project-tilesPulls in: article-block, badge, box, compose, group, kit-box, kit-text, lucide-icon, media-frame, menu-entry, project-grid, stack, text, title, utils
Preview
, 2026
Atlas dashboard
, 2025
Harbor booking
, 2025
Lumen brand
, 2024
Orbit mobile
, 2024
Field notes
, 2023
Cedar store
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 project-tiles<!-- 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 projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags,
two links), compact cards in four columns, captions over the pictures, or a bento where the first project
takes a big tile.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Project, ProjectLabels } from "../blocks/project-grid.types";
export type ProjectTilesProps = {
projects: Project[];
labels: ProjectLabels;
layout?: "cards" | "compact" | "overlay" | "bento" | "list";
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.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 ArticleBlock from "../components/article-block.svelte";
import MediaFrame from "../components/media-frame.svelte";
import MenuEntry from "../components/menu-entry.svelte";
import { cn, tpl } from "../utils";
let { projects, labels, layout = "cards" }: ProjectTilesProps = $props();
const over = $derived(
(layout as string) === "overlay" ? true
: ((layout as string) === "bento")
);
</script>
<Box
class={
(layout as string) === "compact" ? "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
}
data-slot="items"
>
{#each projects as p, i (p.id)}
<ArticleBlock
class={cn(
"flex flex-col gap-4",
(over ? "relative" : "rounded bg-card inset-ring inset-ring-border p-4"),
((((layout as string) === "bento") && (i === 0)) ? "sm:col-span-2 lg:row-span-2" : "")
)}
testid="item"
>
<Box class={(over ? "h-full" : "relative")}>
<MediaFrame
alt={p.title}
src={p.image}
ratio={(((layout as string) === "compact") ? "1/1" : (over ? "3/4" : "4/3"))}
class={(over ? "h-full" : "")}
/>
{#if (p.featured && ((layout as string) !== "compact"))}
<Badge variant="default" size="default" class="absolute left-4 top-4">
{labels.featured}
</Badge>
{/if}
</Box>
<Stack
gap="2"
align="stretch"
class={(over ? "absolute right-4 bottom-4 left-4 rounded bg-background p-4" : "")}
>
<Text size="xs" class="text-muted-foreground">
{tpl("{0}, {1}", p.category, p.year)}
</Text>
<Title as={3} size={(((layout as string) === "compact") ? "sm" : "lg")} weight="semibold">
{p.title}
</Title>
{#if ((layout as string) !== "compact")}
<Text size="sm" class="text-muted-foreground">
{p.summary}
</Text>
{/if}
{#if ((layout as string) === "cards")}
<Group gap="2" class="flex-wrap">
{#each p.tags as k (k)}
<Badge variant="secondary" size="sm">
{k}
</Badge>
{/each}
</Group>
<Group gap="4" class="pt-2">
<MenuEntry href={p.href} class="inline-flex items-center gap-2 text-sm font-medium">
{labels.case}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
<MenuEntry href={p.href} class="inline-flex items-center gap-2 text-sm font-medium">
{labels.view}
<LucideIcon name="external-link" size={16} />
</MenuEntry>
</Group>
{/if}
</Stack>
</ArticleBlock>
{/each}
</Box>
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 project-tiles// 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 projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags,
* two links), compact cards in four columns, captions over the pictures, or a bento where the first project
* takes a big tile.
*/
import { type ReactNode } from "react";
import { Badge, Box, Group, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { ArticleBlock } from "../components/article-block";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { cn, tpl } from "../utils";
import type { Project, ProjectLabels } from "../blocks/project-grid.types";
export type ProjectTilesProps = {
projects: Project[];
labels: ProjectLabels;
layout?: "cards" | "compact" | "overlay" | "bento" | "list";
};
export function ProjectTiles({ projects, labels, layout = "cards" }: ProjectTilesProps) {
const over = ((layout as string) === "overlay") ? true : ((layout as string) === "bento");
return (
<Box
className={
(layout as string) === "compact" ? "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
}
data-slot="items"
>
{(projects ?? []).map((p, i) => (
<ArticleBlock key={p.id}
className={cn(
"flex flex-col gap-4",
(over ? "relative" : "rounded bg-card inset-ring inset-ring-border p-4"),
((((layout as string) === "bento") && (i === 0)) ? "sm:col-span-2 lg:row-span-2" : "")
)}
testid="item"
>
<Box className={(over ? "h-full" : "relative")}>
<MediaFrame
alt={p.title}
src={p.image}
ratio={(((layout as string) === "compact") ? "1/1" : (over ? "3/4" : "4/3"))}
className={(over ? "h-full" : "")}
/>
{(p.featured && ((layout as string) !== "compact")) ? (
<Badge variant="default" size="default" className="absolute left-4 top-4">
{labels.featured}
</Badge>
) : null}
</Box>
<Stack
gap="2"
align="stretch"
className={(over ? "absolute right-4 bottom-4 left-4 rounded bg-background p-4" : "")}
>
<Text size="xs" className="text-muted-foreground">
{tpl("{0}, {1}", p.category, p.year)}
</Text>
<Title as={3} size={(((layout as string) === "compact") ? "sm" : "lg")} weight="semibold">
{p.title}
</Title>
{((layout as string) !== "compact") ? (
<Text size="sm" className="text-muted-foreground">
{p.summary}
</Text>
) : null}
{((layout as string) === "cards") ? (
<>
<Group gap="2" className="flex-wrap">
{(p.tags ?? []).map((k) => (
<Badge key={k} variant="secondary" size="sm">
{k}
</Badge>
))}
</Group>
<Group gap="4" className="pt-2">
<MenuEntry href={p.href} className="inline-flex items-center gap-2 text-sm font-medium">
{labels.case}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
<MenuEntry href={p.href} className="inline-flex items-center gap-2 text-sm font-medium">
{labels.view}
<LucideIcon name="external-link" size={16} />
</MenuEntry>
</Group>
</>
) : null}
</Stack>
</ArticleBlock>
))}
</Box>
);
}
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 project-tiles<!-- 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 projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags,
two links), compact cards in four columns, captions over the pictures, or a bento where the first project
takes a big tile.
-->
<script lang="ts">
import type { Project, ProjectLabels } from "../blocks/project-grid.types";
export type ProjectTilesProps = {
projects: Project[];
labels: ProjectLabels;
layout?: "cards" | "compact" | "overlay" | "bento" | "list";
};
</script>
<script setup lang="ts">
import { computed } from "vue";
import Badge from "../compose/Badge.vue";
import Box from "../compose/Box.vue";
import Group from "../compose/Group.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 ArticleBlock from "../components/article-block.vue";
import MediaFrame from "../components/media-frame.vue";
import MenuEntry from "../components/menu-entry.vue";
import { cn, tpl } from "../utils";
const { projects, labels, layout = "cards" } = defineProps<ProjectTilesProps>();
const over = computed(() =>
(layout as string) === "overlay" ? true
: ((layout as string) === "bento")
);
</script>
<template>
<Box
:class="
(layout as string) === 'compact' ? 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4'
: 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3'
"
data-slot="items"
>
<ArticleBlock v-for="(p, i) in projects" :key="p.id"
:class="cn(
'flex flex-col gap-4',
(over ? 'relative' : 'rounded bg-card inset-ring inset-ring-border p-4'),
((((layout as string) === 'bento') && (i === 0)) ? 'sm:col-span-2 lg:row-span-2' : '')
)"
testid="item"
>
<Box :class="(over ? 'h-full' : 'relative')">
<MediaFrame
:alt="p.title"
:src="p.image"
:ratio="(((layout as string) === 'compact') ? '1/1' : (over ? '3/4' : '4/3'))"
:class="(over ? 'h-full' : '')"
/>
<Badge
v-if="(p.featured && ((layout as string) !== 'compact'))"
variant="default"
size="default"
class="absolute left-4 top-4"
>
{{ labels.featured }}
</Badge>
</Box>
<Stack
gap="2"
align="stretch"
:class="(over ? 'absolute right-4 bottom-4 left-4 rounded bg-background p-4' : '')"
>
<Text size="xs" class="text-muted-foreground">
{{ tpl("{0}, {1}", p.category, p.year) }}
</Text>
<Title :as="3" :size="(((layout as string) === 'compact') ? 'sm' : 'lg')" weight="semibold">
{{ p.title }}
</Title>
<Text v-if="((layout as string) !== 'compact')" size="sm" class="text-muted-foreground">
{{ p.summary }}
</Text>
<template v-if="((layout as string) === 'cards')">
<Group gap="2" class="flex-wrap">
<Badge v-for="k in p.tags" :key="k" variant="secondary" size="sm">
{{ k }}
</Badge>
</Group>
<Group gap="4" class="pt-2">
<MenuEntry :href="p.href" class="inline-flex items-center gap-2 text-sm font-medium">
{{ labels.case }}
<LucideIcon name="arrow-right" :size="16" />
</MenuEntry>
<MenuEntry :href="p.href" class="inline-flex items-center gap-2 text-sm font-medium">
{{ labels.view }}
<LucideIcon name="external-link" :size="16" />
</MenuEntry>
</Group>
</template>
</Stack>
</ArticleBlock>
</Box>
</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 project-tiles// 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 projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags,
* two links), compact cards in four columns, captions over the pictures, or a bento where the first project
* takes a big tile.
*/
import { For, type JSX } from "solid-js";
import { Badge, Box, Group, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { ArticleBlock } from "../components/article-block";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { cn, tpl } from "../utils";
import type { Project, ProjectLabels } from "../blocks/project-grid.types";
export type ProjectTilesProps = {
projects: Project[];
labels: ProjectLabels;
layout?: "cards" | "compact" | "overlay" | "bento" | "list";
};
export function ProjectTiles({ projects, labels, layout = "cards" }: ProjectTilesProps) {
const over = ((layout as string) === "overlay") ? true : ((layout as string) === "bento");
return (
<Box
class={
(layout as string) === "compact" ? "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
}
data-slot="items"
>
<For each={projects ?? []}>{(p, iOf) => { const i = iOf(); return (
<ArticleBlock
class={cn(
"flex flex-col gap-4",
(over ? "relative" : "rounded bg-card inset-ring inset-ring-border p-4"),
((((layout as string) === "bento") && (i === 0)) ? "sm:col-span-2 lg:row-span-2" : "")
)}
testid="item"
>
<Box class={(over ? "h-full" : "relative")}>
<MediaFrame
alt={p.title}
src={p.image}
ratio={(((layout as string) === "compact") ? "1/1" : (over ? "3/4" : "4/3"))}
class={(over ? "h-full" : "")}
/>
{(p.featured && ((layout as string) !== "compact")) ? (
<Badge variant="default" size="default" class="absolute left-4 top-4">
{labels.featured}
</Badge>
) : null}
</Box>
<Stack
gap="2"
align="stretch"
class={(over ? "absolute right-4 bottom-4 left-4 rounded bg-background p-4" : "")}
>
<Text size="xs" class="text-muted-foreground">
{tpl("{0}, {1}", p.category, p.year)}
</Text>
<Title as={3} size={(((layout as string) === "compact") ? "sm" : "lg")} weight="semibold">
{p.title}
</Title>
{((layout as string) !== "compact") ? (
<Text size="sm" class="text-muted-foreground">
{p.summary}
</Text>
) : null}
{((layout as string) === "cards") ? (
<>
<Group gap="2" class="flex-wrap">
<For each={p.tags ?? []}>{(k) => (
<Badge variant="secondary" size="sm">
{k}
</Badge>
)}</For>
</Group>
<Group gap="4" class="pt-2">
<MenuEntry href={p.href} class="inline-flex items-center gap-2 text-sm font-medium">
{labels.case}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
<MenuEntry href={p.href} class="inline-flex items-center gap-2 text-sm font-medium">
{labels.view}
<LucideIcon name="external-link" size={16} />
</MenuEntry>
</Group>
</>
) : null}
</Stack>
</ArticleBlock>
); }}</For>
</Box>
);
}
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 project-tiles// 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/project-tiles.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"
)
// ProjectTilesProps are the props of ProjectTiles; the values are the JSON shapes of the TypeScript props.
type ProjectTilesProps struct {
Projects any `json:"projects"`
Labels any `json:"labels"`
Layout any `json:"layout"`
}
// The projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags, two links), compact cards in four columns, captions over the pictures, or a bento where the first project takes a big tile.
templ ProjectTiles(p ProjectTilesProps) {
{{ vProjects := p.Projects }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "cards") }}
{{ vOver := any(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "overlay")), true, uiutils.Eq(vLayout, "bento"))) }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "compact")), "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4", "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3")), Attrs: uiutils.Attrs("data-slot", "items")}}) {
for vI, vP := range uiutils.L(vProjects) {
@ArticleBlock(ArticleBlockProps{Class: uiutils.Cnv(uiutils.Cnv("flex flex-col gap-4", uiutils.Cond(uiutils.T(vOver), "relative", "rounded bg-card inset-ring inset-ring-border p-4"), uiutils.Cond(uiutils.T(uiutils.And(uiutils.Eq(vLayout, "bento"), uiutils.Eq(float64(vI), float64(0)))), "sm:col-span-2 lg:row-span-2", ""))), Testid: "item"}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(vOver), "h-full", "relative"))}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vP, "title"), Src: uiutils.Get(vP, "image"), Ratio: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "compact")), "1/1", uiutils.Cond(uiutils.T(vOver), "3/4", "4/3")), Class: uiutils.Cnv(uiutils.Cond(uiutils.T(vOver), "h-full", ""))})
if uiutils.T(uiutils.And(uiutils.Get(vP, "featured"), !uiutils.Eq(vLayout, "compact"))) {
@compose.Badge(compose.BadgeProps{Variant: "default", Size: "default", TextProps: text.TextProps{Class: "absolute left-4 top-4"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "featured")) }
}
}
}
@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(vOver), "absolute right-4 bottom-4 left-4 rounded bg-background p-4", ""))}}) {
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Tpl("{0}, {1}", uiutils.Get(vP, "category"), uiutils.Get(vP, "year"))) }
}
@compose.Title(compose.TitleProps{As: "3", Size: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "compact")), "sm", "lg")), Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "title")) }
}
if !uiutils.Eq(vLayout, "compact") {
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vP, "summary")) }
}
}
if uiutils.Eq(vLayout, "cards") {
@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
for _, vK := range uiutils.L(uiutils.Get(vP, "tags")) {
@compose.Badge(compose.BadgeProps{Variant: "secondary", Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(vK) }
}
}
}
@compose.Group(compose.GroupProps{Gap: "4", BoxProps: box.BoxProps{Class: "pt-2"}}) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vP, "href"), Class: uiutils.Cnv("inline-flex items-center gap-2 text-sm font-medium")}) {
{ uiutils.Text(uiutils.Get(vLabels, "case")) }
@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-right", Size: 16})
}
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vP, "href"), Class: uiutils.Cnv("inline-flex items-center gap-2 text-sm font-medium")}) {
{ uiutils.Text(uiutils.Get(vLabels, "view")) }
@icons.LucideIcon(icons.LucideIconProps{Name: "external-link", Size: 16})
}
}
}
}
}
}
}
}
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 project-tiles{#- 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/project-tiles.json
The projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags, two links), compact cards in four columns, captions over the pictures, or a bento where the first project takes a big tile.
Props (p): projects, labels, layout. -#}
{%- set v_projects = (p.projects ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'cards') -%}
{%- set v_over = (og_t(og_eq(v_layout, 'overlay')) ? true : og_eq(v_layout, 'bento')) -%}
{%- set c_13 -%}
{%- for v_p in og_l(v_projects) %}
{%- set v_i = loop.index0 -%}
{%- set c_12 -%}
{%- set c_2 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': (og_t(og_eq(v_layout, 'compact')) ? '1/1' : (og_t(v_over) ? '3/4' : '4/3')), 'className': og_cnv([(og_t(v_over) ? 'h-full' : '')])}}, with_context = false) }}
{%- if og_t(og_and([og_get(v_p, ['featured']), not (og_eq(v_layout, 'compact'))])) %}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['featured'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'default', 'size': 'default', 'class': 'absolute left-4 top-4', 'children': c_1}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s((og_t(v_over) ? 'h-full' : 'relative')), 'children': c_2}, with_context = false) }}
{%- set c_11 -%}
{%- set c_3 -%}
{{ og_text(og_tpl('{0}, {1}', [og_get(v_p, ['category']), og_get(v_p, ['year'])])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': og_s((og_t(og_eq(v_layout, 'compact')) ? 'sm' : 'lg')), 'weight': 'semibold', 'children': c_4}, with_context = false) }}
{%- if og_t(not (og_eq(v_layout, 'compact'))) %}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['summary'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_layout, 'cards')) %}
{%- set c_7 -%}
{%- for v_k in og_l(og_get(v_p, ['tags'])) %}
{%- set c_6 -%}
{{ og_text(v_k) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'secondary', 'size': 'sm', 'children': c_6}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'class': 'flex-wrap', 'children': c_7}, with_context = false) }}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['case'])) }}
{{ include('icons/LucideIcon.html.twig', {'name': 'arrow-right', 'size': 16}, with_context = false) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])}, 'children': og_markup(c_8)}, with_context = false) }}
{%- set c_9 -%}
{{ og_text(og_get(v_labels, ['view'])) }}
{{ include('icons/LucideIcon.html.twig', {'name': 'external-link', 'size': 16}, with_context = false) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])}, 'children': og_markup(c_9)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'class': 'pt-2', 'children': c_10}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'class': og_s((og_t(v_over) ? 'absolute right-4 bottom-4 left-4 rounded bg-background p-4' : '')), 'children': c_11}, with_context = false) }}
{%- endset -%}
{{ include('blocks/article-block.html.twig', {'p': {'className': og_cnv([og_cnv(['flex flex-col gap-4', (og_t(v_over) ? 'relative' : 'rounded bg-card inset-ring inset-ring-border p-4'), (og_t(og_and([og_eq(v_layout, 'bento'), og_eq(v_i, 0)])) ? 'sm:col-span-2 lg:row-span-2' : '')])]), 'testid': 'item'}, 'children': og_markup(c_12)}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'compact')) ? 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4' : 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_13}, 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 project-tiles{* 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/project-tiles.json
The projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags, two links), compact cards in four columns, captions over the pictures, or a bento where the first project takes a big tile.
Props (p): projects, labels, layout. *}
{var $v_projects = ($p['projects'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'cards')}
{var $v_over = (og_t(og_eq($v_layout, 'overlay')) ? true : og_eq($v_layout, 'bento'))}
{capture $c_13}
{foreach og_l($v_projects) as $v_p}
{var $v_i = $iterator->counter0}
{capture $c_12}
{capture $c_2}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_p, ['title']), 'src' => og_get($v_p, ['image']), 'ratio' => (og_t(og_eq($v_layout, 'compact')) ? '1/1' : (og_t($v_over) ? '3/4' : '4/3')), 'className' => og_cnv([(og_t($v_over) ? 'h-full' : '')])]])|noescape}
{if og_t(og_and([og_get($v_p, ['featured']), !(og_eq($v_layout, 'compact'))]))}
{capture $c_1}
{=og_text(og_get($v_labels, ['featured']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'default', 'size' => 'default', 'class' => 'absolute left-4 top-4', 'children' => (string) $c_1])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s((og_t($v_over) ? 'h-full' : 'relative')), 'children' => (string) $c_2])|noescape}
{capture $c_11}
{capture $c_3}
{=og_text(og_tpl('{0}, {1}', [og_get($v_p, ['category']), og_get($v_p, ['year'])]))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_get($v_p, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => og_s((og_t(og_eq($v_layout, 'compact')) ? 'sm' : 'lg')), 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
{if og_t(!(og_eq($v_layout, 'compact')))}
{capture $c_5}
{=og_text(og_get($v_p, ['summary']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/if}
{if og_t(og_eq($v_layout, 'cards'))}
{capture $c_7}
{foreach og_l(og_get($v_p, ['tags'])) as $v_k}
{capture $c_6}
{=og_text($v_k)}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'secondary', 'size' => 'sm', 'children' => (string) $c_6])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'class' => 'flex-wrap', 'children' => (string) $c_7])|noescape}
{capture $c_10}
{capture $c_8}
{=og_text(og_get($v_labels, ['case']))}
{=og_include('icons/LucideIcon.latte', ['name' => 'arrow-right', 'size' => 16])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_p, ['href']), 'className' => og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])], 'children' => og_markup($c_8)])|noescape}
{capture $c_9}
{=og_text(og_get($v_labels, ['view']))}
{=og_include('icons/LucideIcon.latte', ['name' => 'external-link', 'size' => 16])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_p, ['href']), 'className' => og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])], 'children' => og_markup($c_9)])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'class' => 'pt-2', 'children' => (string) $c_10])|noescape}
{/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'class' => og_s((og_t($v_over) ? 'absolute right-4 bottom-4 left-4 rounded bg-background p-4' : '')), 'children' => (string) $c_11])|noescape}
{/capture}
{=og_include('blocks/article-block.latte', ['p' => ['className' => og_cnv([og_cnv(['flex flex-col gap-4', (og_t($v_over) ? 'relative' : 'rounded bg-card inset-ring inset-ring-border p-4'), (og_t(og_and([og_eq($v_layout, 'bento'), og_eq($v_i, 0)])) ? 'sm:col-span-2 lg:row-span-2' : '')])]), 'testid' => 'item'], 'children' => og_markup($c_12)])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_layout, 'compact')) ? 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4' : 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_13])|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 project-tiles{#- 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/project-tiles.json
The projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags, two links), compact cards in four columns, captions over the pictures, or a bento where the first project takes a big tile.
Props (p): projects, labels, layout. -#}
{%- set v_projects = og_def(p['projects'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'cards') -%}
{%- set v_over = (true if og_t(og_eq(v_layout, 'overlay')) else og_eq(v_layout, 'bento')) -%}
{%- set c_13 -%}
{%- for v_p in og_l(v_projects) %}
{%- set v_i = loop.index0 -%}
{%- set c_12 -%}
{%- set c_2 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': ('1/1' if og_t(og_eq(v_layout, 'compact')) else ('3/4' if og_t(v_over) else '4/3')), 'className': og_cnv([('h-full' if og_t(v_over) else '')])}}) }}
{%- if og_t(og_and([og_get(v_p, ['featured']), not (og_eq(v_layout, 'compact'))])) %}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['featured'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Class': 'absolute left-4 top-4'}, 'children': c_1}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('h-full' if og_t(v_over) else 'relative'))}, 'children': c_2}) }}
{%- set c_11 -%}
{%- set c_3 -%}
{{ og_text(og_tpl('{0}, {1}', [og_get(v_p, ['category']), og_get(v_p, ['year'])])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': og_s(('sm' if og_t(og_eq(v_layout, 'compact')) else 'lg')), 'Weight': 'semibold'}, 'children': c_4}) }}
{%- if og_t(not (og_eq(v_layout, 'compact'))) %}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['summary'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- endif %}
{%- if og_t(og_eq(v_layout, 'cards')) %}
{%- set c_7 -%}
{%- for v_k in og_l(og_get(v_p, ['tags'])) %}
{%- set c_6 -%}
{{ og_text(v_k) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'secondary', 'Size': 'sm'}, 'children': c_6}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Class': 'flex-wrap'}, 'children': c_7}) }}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['case'])) }}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-right', 'Size': 16}}) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])}, 'children': og_markup(c_8)}) }}
{%- set c_9 -%}
{{ og_text(og_get(v_labels, ['view'])) }}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'external-link', 'Size': 16}}) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['inline-flex items-center gap-2 text-sm font-medium'])}, 'children': og_markup(c_9)}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Class': 'pt-2'}, 'children': c_10}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch', 'Class': og_s(('absolute right-4 bottom-4 left-4 rounded bg-background p-4' if og_t(v_over) else ''))}, 'children': c_11}) }}
{%- endset -%}
{{ og_include('blocks/article-block.html.j2', {'p': {'className': og_cnv([og_cnv(['flex flex-col gap-4', ('relative' if og_t(v_over) else 'rounded bg-card inset-ring inset-ring-border p-4'), ('sm:col-span-2 lg:row-span-2' if og_t(og_and([og_eq(v_layout, 'bento'), og_eq(v_i, 0)])) else '')])]), 'testid': 'item'}, 'children': og_markup(c_12)}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4' if og_t(og_eq(v_layout, 'compact')) else 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_13}) }}
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 projects of ProjectGrid as tiles: cards (picture, featured badge, category and year, title, summary, tags, two links), compact cards in four columns, captions over the pictures, or a bento where the first project takes a big tile.
| Prop | Type | Default | Description |
|---|---|---|---|
| projects (required) | Project[] | - | |
| labels (required) | ProjectLabels | - | |
| layout | "cards" | "compact" | "overlay" | "bento" | "list" | "cards" |