Skip to content
ui8kit

block / dashboard

Activity Feed

Recent events as a timeline or a list.

Install

npx ui8kit add activity-feed

Pulls in: block, compose, container, empty-state, kit-box, kit-text, list, list-item, panel, stack, text, timeline, utils

Preview

Recent activity

What happened in your workspace.

  • Plan upgraded to Team

    2 min ago

    Billing changed by Dana Pierce.

  • New member joined

    1 h ago

    Ravi Menon accepted the invitation.

  • Export finished

    Yesterday

    Customers.csv is ready to download.

  • Payment failed

    2 days ago

    The card ending 4242 was declined.

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout
  (timeline, list), density (default, compact), tone (default, muted).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Event } from "./activity-feed.types";

  export type ActivityFeedProps = {
    id: string;
    title: string;
    text: string;
    events: Event[];
    empty?: string;
    layout?: "timeline" | "list";
    density?: "default" | "compact";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Container from "../compose/Container.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import Panel from "../components/panel.svelte";
  import Timeline from "../components/timeline.svelte";
  import { cn, tpl } from "../utils";

  let {
    id,
    title,
    text,
    events,
    empty = "",
    layout = "timeline",
    density = "default",
    tone = "default",
    landmarkLabel,
  }: ActivityFeedProps = $props();
</script>

<Block
  tag="section"
  aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
  aria-label={landmarkLabel}
  data-slot="panel-section"
>
  <Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
    <Panel title={title} description={text} id={id} class={(((tone as string) === "muted") ? "bg-muted" : "")}>
      {#if ((events?.length ?? 0) === 0)}
        <EmptyState icon="activity" title={empty} />
      {:else if ((layout as string) === "timeline")}
        <Timeline items={events} />
      {:else}
        <List class="m-0 flex list-none flex-col p-0" data-slot="items">
          {#each events as e (e.id)}
            <ListItem
              class={cn(
                "flex items-start justify-between gap-4 border-b border-border last:border-0",
                (((density as string) === "compact") ? "py-2" : "py-4")
              )}
              data-slot="item"
            >
              <Stack gap="0">
                <Text size="sm" weight="semibold">
                  {e.title}
                </Text>
                {#if ((density as string) === "default")}
                  <Text size="sm" class="text-muted-foreground">
                    {e.text}
                  </Text>
                {/if}
              </Stack>
              <Text size="xs" class="shrink-0 text-muted-foreground">
                {e.time}
              </Text>
            </ListItem>
          {/each}
        </List>
      {/if}
    </Panel>
  </Container>
</Block>
blocks/activity-feed.types.ts
// 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 Event = {
  id: string;
  title: string;
  text: string;
  time: string;
  tone: string;
};

Svelte registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout
 * (timeline, list), density (default, compact), tone (default, muted).
 */
import { type ReactNode } from "react";
import { Block, Container, List, ListItem, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { Panel } from "../components/panel";
import { Timeline } from "../components/timeline";
import { cn, tpl } from "../utils";
import type { Event } from "./activity-feed.types";

export type ActivityFeedProps = {
  id: string;
  title: string;
  text: string;
  events: Event[];
  empty?: string;
  layout?: "timeline" | "list";
  density?: "default" | "compact";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function ActivityFeed({
  id,
  title,
  text,
  events,
  empty = "",
  layout = "timeline",
  density = "default",
  tone = "default",
  landmarkLabel,
}: ActivityFeedProps) {
  return (
    <Block
      tag="section"
      aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
      aria-label={landmarkLabel}
      data-slot="panel-section"
    >
      <Container className="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
        <Panel title={title} description={text} id={id} className={(((tone as string) === "muted") ? "bg-muted" : "")}>
          {((events?.length ?? 0) === 0) ? (
            <EmptyState icon="activity" title={empty} />
          ) : ((layout as string) === "timeline") ? (
            <Timeline items={events} />
          ) : (
            <List className="m-0 flex list-none flex-col p-0" data-slot="items">
              {(events ?? []).map((e) => (
                <ListItem key={e.id}
                  className={cn(
                    "flex items-start justify-between gap-4 border-b border-border last:border-0",
                    (((density as string) === "compact") ? "py-2" : "py-4")
                  )}
                  data-slot="item"
                >
                  <Stack gap="0">
                    <Text size="sm" weight="semibold">
                      {e.title}
                    </Text>
                    {((density as string) === "default") ? (
                      <Text size="sm" className="text-muted-foreground">
                        {e.text}
                      </Text>
                    ) : null}
                  </Stack>
                  <Text size="xs" className="shrink-0 text-muted-foreground">
                    {e.time}
                  </Text>
                </ListItem>
              ))}
            </List>
          )}
        </Panel>
      </Container>
    </Block>
  );
}
blocks/activity-feed.types.ts
// 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 Event = {
  id: string;
  title: string;
  text: string;
  time: string;
  tone: string;
};

React registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.types.ts
// 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 Event = {
  id: string;
  title: string;
  text: string;
  time: string;
  tone: string;
};
blocks/activity-feed.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout
  (timeline, list), density (default, compact), tone (default, muted).
-->
<script lang="ts">
import type { Event } from "./activity-feed.types";

export type ActivityFeedProps = {
  id: string;
  title: string;
  text: string;
  events: Event[];
  empty?: string;
  layout?: "timeline" | "list";
  density?: "default" | "compact";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Block from "../compose/Block.vue";
import Container from "../compose/Container.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import Panel from "../components/panel.vue";
import Timeline from "../components/timeline.vue";
import { cn, tpl } from "../utils";

const {
  id,
  title,
  text,
  events,
  empty = "",
  layout = "timeline",
  density = "default",
  tone = "default",
  landmarkLabel,
} = defineProps<ActivityFeedProps>();
</script>

<template>
  <Block
    tag="section"
    :aria-labelledby="(landmarkLabel ? undefined : ((title && id) ? tpl('{0}-t', id) : undefined))"
    :aria-label="landmarkLabel"
    data-slot="panel-section"
  >
    <Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
      <Panel :title="title" :description="text" :id="id" :class="(((tone as string) === 'muted') ? 'bg-muted' : '')">
        <EmptyState v-if="((events?.length ?? 0) === 0)" icon="activity" :title="empty" />
        <Timeline v-else-if="((layout as string) === 'timeline')" :items="events" />
        <List v-else class="m-0 flex list-none flex-col p-0" data-slot="items">
          <ListItem v-for="e in events" :key="e.id"
            :class="cn(
              'flex items-start justify-between gap-4 border-b border-border last:border-0',
              (((density as string) === 'compact') ? 'py-2' : 'py-4')
            )"
            data-slot="item"
          >
            <Stack gap="0">
              <Text size="sm" weight="semibold">
                {{ e.title }}
              </Text>
              <Text v-if="((density as string) === 'default')" size="sm" class="text-muted-foreground">
                {{ e.text }}
              </Text>
            </Stack>
            <Text size="xs" class="shrink-0 text-muted-foreground">
              {{ e.time }}
            </Text>
          </ListItem>
        </List>
      </Panel>
    </Container>
  </Block>
</template>

Vue registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout
 * (timeline, list), density (default, compact), tone (default, muted).
 */
import { For, type JSX } from "solid-js";
import { Block, Container, List, ListItem, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { Panel } from "../components/panel";
import { Timeline } from "../components/timeline";
import { cn, tpl } from "../utils";
import type { Event } from "./activity-feed.types";

export type ActivityFeedProps = {
  id: string;
  title: string;
  text: string;
  events: Event[];
  empty?: string;
  layout?: "timeline" | "list";
  density?: "default" | "compact";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function ActivityFeed({
  id,
  title,
  text,
  events,
  empty = "",
  layout = "timeline",
  density = "default",
  tone = "default",
  landmarkLabel,
}: ActivityFeedProps) {
  return (
    <Block
      tag="section"
      aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
      aria-label={landmarkLabel}
      data-slot="panel-section"
    >
      <Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
        <Panel title={title} description={text} id={id} class={(((tone as string) === "muted") ? "bg-muted" : "")}>
          {((events?.length ?? 0) === 0) ? (
            <EmptyState icon="activity" title={empty} />
          ) : ((layout as string) === "timeline") ? (
            <Timeline items={events} />
          ) : (
            <List class="m-0 flex list-none flex-col p-0" data-slot="items">
              <For each={events ?? []}>{(e) => (
                <ListItem
                  class={cn(
                    "flex items-start justify-between gap-4 border-b border-border last:border-0",
                    (((density as string) === "compact") ? "py-2" : "py-4")
                  )}
                  data-slot="item"
                >
                  <Stack gap="0">
                    <Text size="sm" weight="semibold">
                      {e.title}
                    </Text>
                    {((density as string) === "default") ? (
                      <Text size="sm" class="text-muted-foreground">
                        {e.text}
                      </Text>
                    ) : null}
                  </Stack>
                  <Text size="xs" class="shrink-0 text-muted-foreground">
                    {e.time}
                  </Text>
                </ListItem>
              )}</For>
            </List>
          )}
        </Panel>
      </Container>
    </Block>
  );
}
blocks/activity-feed.types.ts
// 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 Event = {
  id: string;
  title: string;
  text: string;
  time: string;
  tone: string;
};

Solid registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.templ
// 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/activity-feed.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"
)

// ActivityFeedProps are the props of ActivityFeed; the values are the JSON shapes of the TypeScript props.
type ActivityFeedProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Events any `json:"events"`
	Empty any `json:"empty"`
	Layout any `json:"layout"`
	Density any `json:"density"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout (timeline, list), density (default, compact), tone (default, muted).
templ ActivityFeed(p ActivityFeedProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vEvents := p.Events }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLayout := uiutils.Def(p.Layout, "timeline") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Attrs: uiutils.Attrs("aria-labelledby", uiutils.Cond(uiutils.T(vLandmarkLabel), nil, uiutils.Cond(uiutils.T(uiutils.And(vTitle, vId)), uiutils.Tpl("{0}-t", vId), nil)), "aria-label", vLandmarkLabel, "data-slot", "panel-section")}}) {
		@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: "mx-auto w-full max-w-6xl px-4 py-8", Attrs: uiutils.Attrs("data-slot", "container")}}) {
			@Panel(PanelProps{Title: vTitle, Description: vText, Id: vId, Class: uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vTone, "muted")), "bg-muted", ""))}) {
				if uiutils.Eq(uiutils.Len(vEvents), float64(0)) {
					@EmptyState(EmptyStateProps{Icon: "activity", Title: vEmpty})
				} else if uiutils.Eq(vLayout, "timeline") {
					@Timeline(TimelineProps{Items: vEvents})
				} else {
					@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col p-0", Attrs: uiutils.Attrs("data-slot", "items")}}) {
						for _, vE := range uiutils.L(vEvents) {
							@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex items-start justify-between gap-4 border-b border-border last:border-0", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "py-2", "py-4"))), Attrs: uiutils.Attrs("data-slot", "item")}}) {
								@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
									@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
										{ uiutils.Text(uiutils.Get(vE, "title")) }
									}
									if uiutils.Eq(vDensity, "default") {
										@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
											{ uiutils.Text(uiutils.Get(vE, "text")) }
										}
									}
								}
								@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "shrink-0 text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vE, "time")) }
								}
							}
						}
					}
				}
			}
		}
	}
}

templ registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.html.twig
{#- 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/activity-feed.json
    A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout (timeline, list), density (default, compact), tone (default, muted).
    Props (p): id, title, text, events, empty, layout, density, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_events = (p.events ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_layout = (p.layout ?? 'timeline') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_7 -%}
      {%- if og_t(og_eq(og_len(v_events), 0)) %}
        {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'activity', 'title': v_empty}}, with_context = false) }}
      {%- elseif og_t(og_eq(v_layout, 'timeline')) %}
        {{ include('blocks/timeline.html.twig', {'p': {'items': v_events}}, with_context = false) }}
      {%- else %}
        {%- set c_6 -%}
          {%- for v_e in og_l(v_events) %}
            {%- set c_5 -%}
              {%- set c_3 -%}
                {%- set c_1 -%}
                  {{ og_text(og_get(v_e, ['title'])) }}
                {%- endset -%}
                {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
                {%- if og_t(og_eq(v_density, 'default')) %}
                  {%- set c_2 -%}
                    {{ og_text(og_get(v_e, ['text'])) }}
                  {%- endset -%}
                  {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
                {%- endif %}
              {%- endset -%}
              {{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_3}, with_context = false) }}
              {%- set c_4 -%}
                {{ og_text(og_get(v_e, ['time'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'shrink-0 text-muted-foreground', 'children': c_4}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/ListItem.html.twig', {'class': og_s(og_cnv(['flex items-start justify-between gap-4 border-b border-border last:border-0', (og_t(og_eq(v_density, 'compact')) ? 'py-2' : 'py-4')])), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_5}, with_context = false) }}
          {%- endfor %}
        {%- endset -%}
        {{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col p-0', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_6}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('blocks/panel.html.twig', {'p': {'title': v_title, 'description': v_text, 'id': v_id, 'className': og_cnv([(og_t(og_eq(v_tone, 'muted')) ? 'bg-muted' : '')])}, 'children': og_markup(c_7)}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Container.html.twig', {'class': 'mx-auto w-full max-w-6xl px-4 py-8', 'attrs': og_attrs(['data-slot', 'container']), 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'attrs': og_attrs(['aria-labelledby', (og_t(v_landmarkLabel) ? null : (og_t(og_and([v_title, v_id])) ? og_tpl('{0}-t', [v_id]) : null)), 'aria-label', v_landmarkLabel, 'data-slot', 'panel-section']), 'children': c_9}, with_context = false) }}

Twig registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.latte
{* 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/activity-feed.json
    A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout (timeline, list), density (default, compact), tone (default, muted).
    Props (p): id, title, text, events, empty, layout, density, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_events = ($p['events'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_layout = ($p['layout'] ?? 'timeline')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_9}
  {capture $c_8}
    {capture $c_7}
      {if og_t(og_eq(og_len($v_events), 0))}
        {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'activity', 'title' => $v_empty]])|noescape}
      {elseif og_t(og_eq($v_layout, 'timeline'))}
        {=og_include('blocks/timeline.latte', ['p' => ['items' => $v_events]])|noescape}
      {else}
        {capture $c_6}
          {foreach og_l($v_events) as $v_e}
            {capture $c_5}
              {capture $c_3}
                {capture $c_1}
                  {=og_text(og_get($v_e, ['title']))}
                {/capture}
                {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
                {if og_t(og_eq($v_density, 'default'))}
                  {capture $c_2}
                    {=og_text(og_get($v_e, ['text']))}
                  {/capture}
                  {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
                {/if}
              {/capture}
              {=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_3])|noescape}
              {capture $c_4}
                {=og_text(og_get($v_e, ['time']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'shrink-0 text-muted-foreground', 'children' => (string) $c_4])|noescape}
            {/capture}
            {=og_include('compose/ListItem.latte', ['class' => og_s(og_cnv(['flex items-start justify-between gap-4 border-b border-border last:border-0', (og_t(og_eq($v_density, 'compact')) ? 'py-2' : 'py-4')])), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_5])|noescape}
          {/foreach}
        {/capture}
        {=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col p-0', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_6])|noescape}
      {/if}
    {/capture}
    {=og_include('blocks/panel.latte', ['p' => ['title' => $v_title, 'description' => $v_text, 'id' => $v_id, 'className' => og_cnv([(og_t(og_eq($v_tone, 'muted')) ? 'bg-muted' : '')])], 'children' => og_markup($c_7)])|noescape}
  {/capture}
  {=og_include('compose/Container.latte', ['class' => 'mx-auto w-full max-w-6xl px-4 py-8', 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'attrs' => og_attrs(['aria-labelledby', (og_t($v_landmarkLabel) ? null : (og_t(og_and([$v_title, $v_id])) ? og_tpl('{0}-t', [$v_id]) : null)), 'aria-label', $v_landmarkLabel, 'data-slot', 'panel-section']), 'children' => (string) $c_9])|noescape}

Latte registry item (JSON)

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-cdn
npx ui8kit add activity-feed
blocks/activity-feed.html.j2
{#- 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/activity-feed.json
    A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout (timeline, list), density (default, compact), tone (default, muted).
    Props (p): id, title, text, events, empty, layout, density, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_events = og_def(p['events'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_layout = og_def(p['layout'], 'timeline') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_7 -%}
      {%- if og_t(og_eq(og_len(v_events), 0)) %}
        {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'activity', 'title': v_empty}}) }}
      {%- elif og_t(og_eq(v_layout, 'timeline')) %}
        {{ og_include('blocks/timeline.html.j2', {'p': {'items': v_events}}) }}
      {%- else %}
        {%- set c_6 -%}
          {%- for v_e in og_l(v_events) %}
            {%- set c_5 -%}
              {%- set c_3 -%}
                {%- set c_1 -%}
                  {{ og_text(og_get(v_e, ['title'])) }}
                {%- endset -%}
                {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
                {%- if og_t(og_eq(v_density, 'default')) %}
                  {%- set c_2 -%}
                    {{ og_text(og_get(v_e, ['text'])) }}
                  {%- endset -%}
                  {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
                {%- endif %}
              {%- endset -%}
              {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_3}) }}
              {%- set c_4 -%}
                {{ og_text(og_get(v_e, ['time'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'shrink-0 text-muted-foreground'}, 'children': c_4}) }}
            {%- endset -%}
            {{ og_include('compose/list-item.html.j2', {'p': {'Class': og_s(og_cnv(['flex items-start justify-between gap-4 border-b border-border last:border-0', ('py-2' if og_t(og_eq(v_density, 'compact')) else 'py-4')])), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_5}) }}
          {%- endfor %}
        {%- endset -%}
        {{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col p-0', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_6}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('blocks/panel.html.j2', {'p': {'title': v_title, 'description': v_text, 'id': v_id, 'className': og_cnv([('bg-muted' if og_t(og_eq(v_tone, 'muted')) else '')])}, 'children': og_markup(c_7)}) }}
  {%- endset -%}
  {{ og_include('compose/container.html.j2', {'p': {'Class': 'mx-auto w-full max-w-6xl px-4 py-8', 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Attrs': og_attrs(['aria-labelledby', (none if og_t(v_landmarkLabel) else (og_tpl('{0}-t', [v_id]) if og_t(og_and([v_title, v_id])) else none)), 'aria-label', v_landmarkLabel, 'data-slot', 'panel-section'])}, 'children': c_9}) }}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

A panel with recent events: a timeline with dots on a line, or a list of rows with an icon. Axes: layout (timeline, list), density (default, compact), tone (default, muted).

Props of ActivityFeed
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-
events (required)Event[]-
empty string""the text of the empty state (no records), from the dictionary
layout "timeline" | "list""timeline"
density "default" | "compact""default"
tone "default" | "muted""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

Used in