Before After
Two sides of the same points: how it was and how it is, as two cards or as rows.
Install
npx ui8kit add before-afterPulls in: card, card-content, compose, empty-state, grid, group, kit-box, kit-text, list, list-item, lucide-icon, section-frame, stack, text, title, utils
Preview
Before and after
Before
Weeks of wiring
Copied by hand
Colors set one by one
Review by eye
After
One command
Composed from blocks
Tokens shared by every block
Automatic on every build
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 before-after<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two
cards, rows: one row per point), icons (show, hide), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Contrast, BeforeAfterLabels } from "./before-after.types";
export type BeforeAfterProps = {
id: string;
title: string;
points: Contrast[];
empty?: string;
labels: BeforeAfterLabels;
layout?: "cards" | "rows";
icons?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Card from "../compose/Card.svelte";
import CardContent from "../compose/CardContent.svelte";
import Grid from "../compose/Grid.svelte";
import Group from "../compose/Group.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.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 SectionFrame from "../components/section-frame.svelte";
import { cn } from "../utils";
let {
id,
title,
points,
empty = "",
labels,
layout = "cards",
icons = "show",
tone = "default",
density = "default",
landmarkLabel,
}: BeforeAfterProps = $props();
</script>
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{#if ((points?.length ?? 0) === 0)}
<EmptyState icon="git-compare" title={empty} />
{:else if ((layout as string) === "cards")}
<Grid cols="1-2" class="items-stretch gap-4" data-slot="sides">
<Card
variant="muted"
class={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="before"
>
<CardContent class="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.before}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
{#each points as p (p.id)}
<ListItem class="flex items-start gap-4" data-slot="item">
{#if ((icons as string) === "show")}
<LucideIcon name="x" size={16} class="h-lh shrink-0 text-sm" />
{/if}
<Text size="sm">
{p.before}
</Text>
</ListItem>
{/each}
</List>
</CardContent>
</Card>
<Card
variant="default"
class={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="after"
>
<CardContent class="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.after}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
{#each points as p (p.id)}
<ListItem class="flex items-start gap-4" data-slot="item">
{#if ((icons as string) === "show")}
<LucideIcon name="check" size={16} class="h-lh shrink-0 text-sm" />
{/if}
<Text size="sm">
{p.after}
</Text>
</ListItem>
{/each}
</List>
</CardContent>
</Card>
</Grid>
{:else}
<Stack gap="2" align="stretch" data-slot="rows">
{#each points as p (p.id)}
<Grid
cols="1-3"
class={cn("items-center gap-4", "rounded bg-card inset-ring inset-ring-border p-4")}
data-slot="item"
>
<Text size="base" weight="semibold">
{p.title}
</Text>
<Group gap="2" align="start">
{#if ((icons as string) === "show")}
<LucideIcon name="x" size={16} class="h-lh shrink-0 text-sm text-muted-foreground" />
{/if}
<Text size="sm" class="text-muted-foreground">
{p.before}
</Text>
</Group>
<Group gap="2" align="start">
{#if ((icons as string) === "show")}
<LucideIcon name="check" size={16} class="h-lh shrink-0 text-sm text-primary" />
{/if}
<Text size="sm" weight="semibold">
{p.after}
</Text>
</Group>
</Grid>
{/each}
</Stack>
{/if}
</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 Contrast = {
id: string;
title: string;
before: string;
after: string;
};
export type BeforeAfterLabels = {
before: string;
after: 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 before-after// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two
* cards, rows: one row per point), icons (show, hide), tone, density.
*/
import { type ReactNode } from "react";
import { Card, CardContent, Grid, Group, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Contrast, BeforeAfterLabels } from "./before-after.types";
export type BeforeAfterProps = {
id: string;
title: string;
points: Contrast[];
empty?: string;
labels: BeforeAfterLabels;
layout?: "cards" | "rows";
icons?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function BeforeAfter({
id,
title,
points,
empty = "",
labels,
layout = "cards",
icons = "show",
tone = "default",
density = "default",
landmarkLabel,
}: BeforeAfterProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((points?.length ?? 0) === 0) ? (
<EmptyState icon="git-compare" title={empty} />
) : ((layout as string) === "cards") ? (
<Grid cols="1-2" className="items-stretch gap-4" data-slot="sides">
<Card
variant="muted"
className={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="before"
>
<CardContent className="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.before}
</Title>
<List className="m-0 flex list-none flex-col gap-4 p-0">
{(points ?? []).map((p) => (
<ListItem key={p.id} className="flex items-start gap-4" data-slot="item">
{((icons as string) === "show") ? (
<LucideIcon name="x" size={16} className="h-lh shrink-0 text-sm" />
) : null}
<Text size="sm">
{p.before}
</Text>
</ListItem>
))}
</List>
</CardContent>
</Card>
<Card
variant="default"
className={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="after"
>
<CardContent className="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.after}
</Title>
<List className="m-0 flex list-none flex-col gap-4 p-0">
{(points ?? []).map((p) => (
<ListItem key={p.id} className="flex items-start gap-4" data-slot="item">
{((icons as string) === "show") ? (
<LucideIcon name="check" size={16} className="h-lh shrink-0 text-sm" />
) : null}
<Text size="sm">
{p.after}
</Text>
</ListItem>
))}
</List>
</CardContent>
</Card>
</Grid>
) : (
<Stack gap="2" align="stretch" data-slot="rows">
{(points ?? []).map((p) => (
<Grid key={p.id}
cols="1-3"
className={cn("items-center gap-4", "rounded bg-card inset-ring inset-ring-border p-4")}
data-slot="item"
>
<Text size="base" weight="semibold">
{p.title}
</Text>
<Group gap="2" align="start">
{((icons as string) === "show") ? (
<LucideIcon name="x" size={16} className="h-lh shrink-0 text-sm text-muted-foreground" />
) : null}
<Text size="sm" className="text-muted-foreground">
{p.before}
</Text>
</Group>
<Group gap="2" align="start">
{((icons as string) === "show") ? (
<LucideIcon name="check" size={16} className="h-lh shrink-0 text-sm text-primary" />
) : null}
<Text size="sm" weight="semibold">
{p.after}
</Text>
</Group>
</Grid>
))}
</Stack>
)}
</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 Contrast = {
id: string;
title: string;
before: string;
after: string;
};
export type BeforeAfterLabels = {
before: string;
after: 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 before-after// 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 Contrast = {
id: string;
title: string;
before: string;
after: string;
};
export type BeforeAfterLabels = {
before: string;
after: 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. -->
<!--
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two
cards, rows: one row per point), icons (show, hide), tone, density.
-->
<script lang="ts">
import type { Contrast, BeforeAfterLabels } from "./before-after.types";
export type BeforeAfterProps = {
id: string;
title: string;
points: Contrast[];
empty?: string;
labels: BeforeAfterLabels;
layout?: "cards" | "rows";
icons?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Card from "../compose/Card.vue";
import CardContent from "../compose/CardContent.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.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 SectionFrame from "../components/section-frame.vue";
import { cn } from "../utils";
const {
id,
title,
points,
empty = "",
labels,
layout = "cards",
icons = "show",
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<BeforeAfterProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :tone="tone" :density="density" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((points?.length ?? 0) === 0)" icon="git-compare" :title="empty" />
<Grid v-else-if="((layout as string) === 'cards')" cols="1-2" class="items-stretch gap-4" data-slot="sides">
<Card
variant="muted"
:class="cn('h-full', (((density as string) === 'compact') ? 'gap-4 p-4' : ''))"
data-side="before"
>
<CardContent class="flex flex-col gap-4">
<Title :as="3" size="xl" weight="bold">
{{ labels.before }}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
<ListItem v-for="p in points" :key="p.id" class="flex items-start gap-4" data-slot="item">
<LucideIcon v-if="((icons as string) === 'show')" name="x" :size="16" class="h-lh shrink-0 text-sm" />
<Text size="sm">
{{ p.before }}
</Text>
</ListItem>
</List>
</CardContent>
</Card>
<Card
variant="default"
:class="cn('h-full', (((density as string) === 'compact') ? 'gap-4 p-4' : ''))"
data-side="after"
>
<CardContent class="flex flex-col gap-4">
<Title :as="3" size="xl" weight="bold">
{{ labels.after }}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
<ListItem v-for="p in points" :key="p.id" class="flex items-start gap-4" data-slot="item">
<LucideIcon v-if="((icons as string) === 'show')" name="check" :size="16" class="h-lh shrink-0 text-sm" />
<Text size="sm">
{{ p.after }}
</Text>
</ListItem>
</List>
</CardContent>
</Card>
</Grid>
<Stack v-else gap="2" align="stretch" data-slot="rows">
<Grid v-for="p in points" :key="p.id"
cols="1-3"
:class="cn('items-center gap-4', 'rounded bg-card inset-ring inset-ring-border p-4')"
data-slot="item"
>
<Text size="base" weight="semibold">
{{ p.title }}
</Text>
<Group gap="2" align="start">
<LucideIcon
v-if="((icons as string) === 'show')"
name="x"
:size="16"
class="h-lh shrink-0 text-sm text-muted-foreground"
/>
<Text size="sm" class="text-muted-foreground">
{{ p.before }}
</Text>
</Group>
<Group gap="2" align="start">
<LucideIcon
v-if="((icons as string) === 'show')"
name="check"
:size="16"
class="h-lh shrink-0 text-sm text-primary"
/>
<Text size="sm" weight="semibold">
{{ p.after }}
</Text>
</Group>
</Grid>
</Stack>
</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 before-after// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two
* cards, rows: one row per point), icons (show, hide), tone, density.
*/
import { For, type JSX } from "solid-js";
import { Card, CardContent, Grid, Group, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Contrast, BeforeAfterLabels } from "./before-after.types";
export type BeforeAfterProps = {
id: string;
title: string;
points: Contrast[];
empty?: string;
labels: BeforeAfterLabels;
layout?: "cards" | "rows";
icons?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function BeforeAfter({
id,
title,
points,
empty = "",
labels,
layout = "cards",
icons = "show",
tone = "default",
density = "default",
landmarkLabel,
}: BeforeAfterProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((points?.length ?? 0) === 0) ? (
<EmptyState icon="git-compare" title={empty} />
) : ((layout as string) === "cards") ? (
<Grid cols="1-2" class="items-stretch gap-4" data-slot="sides">
<Card
variant="muted"
class={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="before"
>
<CardContent class="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.before}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
<For each={points ?? []}>{(p) => (
<ListItem class="flex items-start gap-4" data-slot="item">
{((icons as string) === "show") ? (
<LucideIcon name="x" size={16} class="h-lh shrink-0 text-sm" />
) : null}
<Text size="sm">
{p.before}
</Text>
</ListItem>
)}</For>
</List>
</CardContent>
</Card>
<Card
variant="default"
class={cn("h-full", (((density as string) === "compact") ? "gap-4 p-4" : ""))}
data-side="after"
>
<CardContent class="flex flex-col gap-4">
<Title as={3} size="xl" weight="bold">
{labels.after}
</Title>
<List class="m-0 flex list-none flex-col gap-4 p-0">
<For each={points ?? []}>{(p) => (
<ListItem class="flex items-start gap-4" data-slot="item">
{((icons as string) === "show") ? (
<LucideIcon name="check" size={16} class="h-lh shrink-0 text-sm" />
) : null}
<Text size="sm">
{p.after}
</Text>
</ListItem>
)}</For>
</List>
</CardContent>
</Card>
</Grid>
) : (
<Stack gap="2" align="stretch" data-slot="rows">
<For each={points ?? []}>{(p) => (
<Grid
cols="1-3"
class={cn("items-center gap-4", "rounded bg-card inset-ring inset-ring-border p-4")}
data-slot="item"
>
<Text size="base" weight="semibold">
{p.title}
</Text>
<Group gap="2" align="start">
{((icons as string) === "show") ? (
<LucideIcon name="x" size={16} class="h-lh shrink-0 text-sm text-muted-foreground" />
) : null}
<Text size="sm" class="text-muted-foreground">
{p.before}
</Text>
</Group>
<Group gap="2" align="start">
{((icons as string) === "show") ? (
<LucideIcon name="check" size={16} class="h-lh shrink-0 text-sm text-primary" />
) : null}
<Text size="sm" weight="semibold">
{p.after}
</Text>
</Group>
</Grid>
)}</For>
</Stack>
)}
</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 Contrast = {
id: string;
title: string;
before: string;
after: string;
};
export type BeforeAfterLabels = {
before: string;
after: 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 before-after// 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/before-after.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"
)
// BeforeAfterProps are the props of BeforeAfter; the values are the JSON shapes of the TypeScript props.
type BeforeAfterProps struct {
Id any `json:"id"`
Title any `json:"title"`
Points any `json:"points"`
Empty any `json:"empty"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Icons any `json:"icons"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two cards, rows: one row per point), icons (show, hide), tone, density.
templ BeforeAfter(p BeforeAfterProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vPoints := p.Points }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "cards") }}
{{ vIcons := uiutils.Def(p.Icons, "show") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vPoints), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "git-compare", Title: vEmpty})
} else if uiutils.Eq(vLayout, "cards") {
@compose.Grid(compose.GridProps{Cols: "1-2", BoxProps: box.BoxProps{Class: "items-stretch gap-4", Attrs: uiutils.Attrs("data-slot", "sides")}}) {
@compose.Card(compose.CardProps{Variant: "muted", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("h-full", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "gap-4 p-4", ""))), Attrs: uiutils.Attrs("data-side", "before")}}) {
@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-4"}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vLabels, "before")) }
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-4 p-0"}}) {
for _, vP := range uiutils.L(vPoints) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-start gap-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
if uiutils.Eq(vIcons, "show") {
@icons.LucideIcon(icons.LucideIconProps{Name: "x", Size: 16, Class: "h-lh shrink-0 text-sm"})
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "before")) }
}
}
}
}
}
}
@compose.Card(compose.CardProps{Variant: "default", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("h-full", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "gap-4 p-4", ""))), Attrs: uiutils.Attrs("data-side", "after")}}) {
@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-4"}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vLabels, "after")) }
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-4 p-0"}}) {
for _, vP := range uiutils.L(vPoints) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-start gap-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
if uiutils.Eq(vIcons, "show") {
@icons.LucideIcon(icons.LucideIconProps{Name: "check", Size: 16, Class: "h-lh shrink-0 text-sm"})
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "after")) }
}
}
}
}
}
}
}
} else {
@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "rows")}}) {
for _, vP := range uiutils.L(vPoints) {
@compose.Grid(compose.GridProps{Cols: "1-3", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("items-center gap-4", "rounded bg-card inset-ring inset-ring-border p-4")), Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "title")) }
}
@compose.Group(compose.GroupProps{Gap: "2", Align: "start", BoxProps: box.BoxProps{}}) {
if uiutils.Eq(vIcons, "show") {
@icons.LucideIcon(icons.LucideIconProps{Name: "x", Size: 16, Class: "h-lh shrink-0 text-sm text-muted-foreground"})
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vP, "before")) }
}
}
@compose.Group(compose.GroupProps{Gap: "2", Align: "start", BoxProps: box.BoxProps{}}) {
if uiutils.Eq(vIcons, "show") {
@icons.LucideIcon(icons.LucideIconProps{Name: "check", Size: 16, Class: "h-lh shrink-0 text-sm text-primary"})
}
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "after")) }
}
}
}
}
}
}
}
}
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 before-after{#- 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/before-after.json
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two cards, rows: one row per point), icons (show, hide), tone, density.
Props (p): id, title, points, empty, labels, layout, icons, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_points = (p.points ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'cards') -%}
{%- set v_icons = (p.icons ?? 'show') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_21 -%}
{%- if og_t(og_eq(og_len(v_points), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'git-compare', 'title': v_empty}}, with_context = false) }}
{%- elseif og_t(og_eq(v_layout, 'cards')) %}
{%- set c_13 -%}
{%- set c_6 -%}
{%- set c_5 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['before'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'bold', 'children': c_1}, with_context = false) }}
{%- set c_4 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_3 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ include('icons/LucideIcon.html.twig', {'name': 'x', 'size': 16, 'class': 'h-lh shrink-0 text-sm'}, with_context = false) }}
{%- endif %}
{%- set c_2 -%}
{{ og_text(og_get(v_p, ['before'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-start gap-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_3}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-4 p-0', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/CardContent.html.twig', {'class': 'flex flex-col gap-4', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'muted', 'class': og_s(og_cnv(['h-full', (og_t(og_eq(v_density, 'compact')) ? 'gap-4 p-4' : '')])), 'attrs': og_attrs(['data-side', 'before']), 'children': c_6}, with_context = false) }}
{%- set c_12 -%}
{%- set c_11 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['after'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'bold', 'children': c_7}, with_context = false) }}
{%- set c_10 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_9 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ include('icons/LucideIcon.html.twig', {'name': 'check', 'size': 16, 'class': 'h-lh shrink-0 text-sm'}, with_context = false) }}
{%- endif %}
{%- set c_8 -%}
{{ og_text(og_get(v_p, ['after'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-start gap-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_9}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-4 p-0', 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/CardContent.html.twig', {'class': 'flex flex-col gap-4', 'children': c_11}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'default', 'class': og_s(og_cnv(['h-full', (og_t(og_eq(v_density, 'compact')) ? 'gap-4 p-4' : '')])), 'attrs': og_attrs(['data-side', 'after']), 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-2', 'class': 'items-stretch gap-4', 'attrs': og_attrs(['data-slot', 'sides']), 'children': c_13}, with_context = false) }}
{%- else %}
{%- set c_20 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_19 -%}
{%- set c_14 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_14}, with_context = false) }}
{%- set c_16 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ include('icons/LucideIcon.html.twig', {'name': 'x', 'size': 16, 'class': 'h-lh shrink-0 text-sm text-muted-foreground'}, with_context = false) }}
{%- endif %}
{%- set c_15 -%}
{{ og_text(og_get(v_p, ['before'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_15}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'start', 'children': c_16}, with_context = false) }}
{%- set c_18 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ include('icons/LucideIcon.html.twig', {'name': 'check', 'size': 16, 'class': 'h-lh shrink-0 text-sm text-primary'}, with_context = false) }}
{%- endif %}
{%- set c_17 -%}
{{ og_text(og_get(v_p, ['after'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_17}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'start', 'children': c_18}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-3', 'class': og_s(og_cnv(['items-center gap-4', 'rounded bg-card inset-ring inset-ring-border p-4'])), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_19}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'rows']), 'children': c_20}, 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_21)}, 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 before-after{* 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/before-after.json
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two cards, rows: one row per point), icons (show, hide), tone, density.
Props (p): id, title, points, empty, labels, layout, icons, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_points = ($p['points'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'cards')}
{var $v_icons = ($p['icons'] ?? 'show')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_21}
{if og_t(og_eq(og_len($v_points), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'git-compare', 'title' => $v_empty]])|noescape}
{elseif og_t(og_eq($v_layout, 'cards'))}
{capture $c_13}
{capture $c_6}
{capture $c_5}
{capture $c_1}
{=og_text(og_get($v_labels, ['before']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
{capture $c_4}
{foreach og_l($v_points) as $v_p}
{capture $c_3}
{if og_t(og_eq($v_icons, 'show'))}
{=og_include('icons/LucideIcon.latte', ['name' => 'x', 'size' => 16, 'class' => 'h-lh shrink-0 text-sm'])|noescape}
{/if}
{capture $c_2}
{=og_text(og_get($v_p, ['before']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-start gap-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_3])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-4 p-0', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/CardContent.latte', ['class' => 'flex flex-col gap-4', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'muted', 'class' => og_s(og_cnv(['h-full', (og_t(og_eq($v_density, 'compact')) ? 'gap-4 p-4' : '')])), 'attrs' => og_attrs(['data-side', 'before']), 'children' => (string) $c_6])|noescape}
{capture $c_12}
{capture $c_11}
{capture $c_7}
{=og_text(og_get($v_labels, ['after']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'bold', 'children' => (string) $c_7])|noescape}
{capture $c_10}
{foreach og_l($v_points) as $v_p}
{capture $c_9}
{if og_t(og_eq($v_icons, 'show'))}
{=og_include('icons/LucideIcon.latte', ['name' => 'check', 'size' => 16, 'class' => 'h-lh shrink-0 text-sm'])|noescape}
{/if}
{capture $c_8}
{=og_text(og_get($v_p, ['after']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-start gap-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_9])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-4 p-0', 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/CardContent.latte', ['class' => 'flex flex-col gap-4', 'children' => (string) $c_11])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'default', 'class' => og_s(og_cnv(['h-full', (og_t(og_eq($v_density, 'compact')) ? 'gap-4 p-4' : '')])), 'attrs' => og_attrs(['data-side', 'after']), 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-2', 'class' => 'items-stretch gap-4', 'attrs' => og_attrs(['data-slot', 'sides']), 'children' => (string) $c_13])|noescape}
{else}
{capture $c_20}
{foreach og_l($v_points) as $v_p}
{capture $c_19}
{capture $c_14}
{=og_text(og_get($v_p, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_14])|noescape}
{capture $c_16}
{if og_t(og_eq($v_icons, 'show'))}
{=og_include('icons/LucideIcon.latte', ['name' => 'x', 'size' => 16, 'class' => 'h-lh shrink-0 text-sm text-muted-foreground'])|noescape}
{/if}
{capture $c_15}
{=og_text(og_get($v_p, ['before']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_15])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'start', 'children' => (string) $c_16])|noescape}
{capture $c_18}
{if og_t(og_eq($v_icons, 'show'))}
{=og_include('icons/LucideIcon.latte', ['name' => 'check', 'size' => 16, 'class' => 'h-lh shrink-0 text-sm text-primary'])|noescape}
{/if}
{capture $c_17}
{=og_text(og_get($v_p, ['after']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_17])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'start', 'children' => (string) $c_18])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-3', 'class' => og_s(og_cnv(['items-center gap-4', 'rounded bg-card inset-ring inset-ring-border p-4'])), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_19])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'rows']), 'children' => (string) $c_20])|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_21)])|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 before-after{#- 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/before-after.json
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two cards, rows: one row per point), icons (show, hide), tone, density.
Props (p): id, title, points, empty, labels, layout, icons, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_points = og_def(p['points'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'cards') -%}
{%- set v_icons = og_def(p['icons'], 'show') -%}
{%- 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_21 -%}
{%- if og_t(og_eq(og_len(v_points), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'git-compare', 'title': v_empty}}) }}
{%- elif og_t(og_eq(v_layout, 'cards')) %}
{%- set c_13 -%}
{%- set c_6 -%}
{%- set c_5 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['before'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'bold'}, 'children': c_1}) }}
{%- set c_4 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_3 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'x', 'Size': 16, 'Class': 'h-lh shrink-0 text-sm'}}) }}
{%- endif %}
{%- set c_2 -%}
{{ og_text(og_get(v_p, ['before'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-start gap-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_3}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-4 p-0'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/card-content.html.j2', {'p': {'Class': 'flex flex-col gap-4'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'muted', 'Class': og_s(og_cnv(['h-full', ('gap-4 p-4' if og_t(og_eq(v_density, 'compact')) else '')])), 'Attrs': og_attrs(['data-side', 'before'])}, 'children': c_6}) }}
{%- set c_12 -%}
{%- set c_11 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['after'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'bold'}, 'children': c_7}) }}
{%- set c_10 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_9 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'check', 'Size': 16, 'Class': 'h-lh shrink-0 text-sm'}}) }}
{%- endif %}
{%- set c_8 -%}
{{ og_text(og_get(v_p, ['after'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm'}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-start gap-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_9}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-4 p-0'}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/card-content.html.j2', {'p': {'Class': 'flex flex-col gap-4'}, 'children': c_11}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'default', 'Class': og_s(og_cnv(['h-full', ('gap-4 p-4' if og_t(og_eq(v_density, 'compact')) else '')])), 'Attrs': og_attrs(['data-side', 'after'])}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-2', 'Class': 'items-stretch gap-4', 'Attrs': og_attrs(['data-slot', 'sides'])}, 'children': c_13}) }}
{%- else %}
{%- set c_20 -%}
{%- for v_p in og_l(v_points) %}
{%- set c_19 -%}
{%- set c_14 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_14}) }}
{%- set c_16 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'x', 'Size': 16, 'Class': 'h-lh shrink-0 text-sm text-muted-foreground'}}) }}
{%- endif %}
{%- set c_15 -%}
{{ og_text(og_get(v_p, ['before'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_15}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'start'}, 'children': c_16}) }}
{%- set c_18 -%}
{%- if og_t(og_eq(v_icons, 'show')) %}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'check', 'Size': 16, 'Class': 'h-lh shrink-0 text-sm text-primary'}}) }}
{%- endif %}
{%- set c_17 -%}
{{ og_text(og_get(v_p, ['after'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_17}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'start'}, 'children': c_18}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-3', 'Class': og_s(og_cnv(['items-center gap-4', 'rounded bg-card inset-ring inset-ring-border p-4'])), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_19}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'rows'])}, 'children': c_20}) }}
{%- 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_21)}) }}
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.
Two columns that set life without the product against life with it, point by point. Axes: layout (cards: two cards, rows: one row per point), icons (show, hide), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| points (required) | Contrast[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| labels (required) | BeforeAfterLabels | - | |
| layout | "cards" | "rows" | "cards" | |
| icons | "show" | "hide" | "show" | |
| 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 |