Skip to content
ui8kit

block / dashboard

Dashboard Overview

Counters, a chart and recent activity in one section.

Install

npx ui8kit add dashboard-overview

Pulls in: activity-feed, bar-chart, box, chart-panel, compose, grid, kit-box, metric-row, panel, section-frame, stack, stat-tile, timeline, utils

Preview

This week at a glance

Revenue

$48,200

+8% this month

Orders

1,284

+3% this month

Visitors

92,410

+12% this month

Churn

1.9%

-0.2% this month

Orders this week

Orders per day over the last seven days.

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 dashboard-overview
blocks/dashboard-overview.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. -->
<!--
  The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the
  activity side by side, stacked: one below the other), cols (2, 4), tone, density.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
  import type { Metric } from "./metric-row.types";
  import type { Point } from "./chart-panel.types";
  import type { Event } from "./activity-feed.types";

  export type DashboardOverviewProps = {
    id: string;
    title: string;
    metrics: Metric[];
    chart: OverviewChart;
    activity: OverviewActivity;
    layout?: "split" | "stacked";
    cols?: "2" | "4";
    tone?: "default" | "muted";
    density?: "default" | "compact";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Grid from "../compose/Grid.svelte";
  import Stack from "../compose/Stack.svelte";
  import BarChart from "../components/bar-chart.svelte";
  import Panel from "../components/panel.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import StatTile from "../components/stat-tile.svelte";
  import Timeline from "../components/timeline.svelte";
  import { tpl } from "../utils";

  let {
    id,
    title,
    metrics,
    chart,
    activity,
    layout = "split",
    cols = "4",
    tone = "default",
    density = "default",
    landmarkLabel,
  }: DashboardOverviewProps = $props();
</script>

<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
  <Stack gap="6" align="stretch">
    {#if ((metrics?.length ?? 0) > 0)}
      <Grid cols={(((cols as string) === "2") ? "1-2" : "1-4")} class="gap-4" data-slot="items">
        {#each metrics as m (m.id)}
          <Box data-slot="item">
            <StatTile label={m.label} value={m.value} icon={m.icon} hint={m.hint} />
          </Box>
        {/each}
      </Grid>
    {/if}
    <Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-stretch gap-4" data-slot="panels">
      {#if ((chart.series?.length ?? 0) > 0)}
        <Panel title={chart.title} description={chart.text} id={tpl("{0}-chart", id)} class="h-full">
          <BarChart bars={chart.series} label={chart.summary} height={144} />
        </Panel>
      {/if}
      {#if ((activity.events?.length ?? 0) > 0)}
        <Panel title={activity.title} description={activity.text} id={tpl("{0}-feed", id)} class="h-full">
          <Timeline items={activity.events} />
        </Panel>
      {/if}
    </Grid>
  </Stack>
</SectionFrame>
blocks/dashboard-overview.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.

import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type OverviewChart = {
  title: string;
  text: string;
  /** the chart's accessible summary */
  summary: string;
  /** the bars */
  series: Point[];
};

export type OverviewActivity = {
  title: string;
  text: string;
  events: Event[];
};

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 dashboard-overview
blocks/dashboard-overview.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.
/**
 * The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the
 * activity side by side, stacked: one below the other), cols (2, 4), tone, density.
 */
import { type ReactNode } from "react";
import { Box, Grid, Stack } from "../compose";
import { BarChart } from "../components/bar-chart";
import { Panel } from "../components/panel";
import { SectionFrame } from "../components/section-frame";
import { StatTile } from "../components/stat-tile";
import { Timeline } from "../components/timeline";
import { tpl } from "../utils";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type DashboardOverviewProps = {
  id: string;
  title: string;
  metrics: Metric[];
  chart: OverviewChart;
  activity: OverviewActivity;
  layout?: "split" | "stacked";
  cols?: "2" | "4";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function DashboardOverview({
  id,
  title,
  metrics,
  chart,
  activity,
  layout = "split",
  cols = "4",
  tone = "default",
  density = "default",
  landmarkLabel,
}: DashboardOverviewProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
      <Stack gap="6" align="stretch">
        {((metrics?.length ?? 0) > 0) ? (
          <Grid cols={(((cols as string) === "2") ? "1-2" : "1-4")} className="gap-4" data-slot="items">
            {(metrics ?? []).map((m) => (
              <Box key={m.id} data-slot="item">
                <StatTile label={m.label} value={m.value} icon={m.icon} hint={m.hint} />
              </Box>
            ))}
          </Grid>
        ) : null}
        <Grid
          cols={(((layout as string) === "split") ? "1-2" : "1")}
          className="items-stretch gap-4"
          data-slot="panels"
        >
          {((chart.series?.length ?? 0) > 0) ? (
            <Panel title={chart.title} description={chart.text} id={tpl("{0}-chart", id)} className="h-full">
              <BarChart bars={chart.series} label={chart.summary} height={144} />
            </Panel>
          ) : null}
          {((activity.events?.length ?? 0) > 0) ? (
            <Panel title={activity.title} description={activity.text} id={tpl("{0}-feed", id)} className="h-full">
              <Timeline items={activity.events} />
            </Panel>
          ) : null}
        </Grid>
      </Stack>
    </SectionFrame>
  );
}
blocks/dashboard-overview.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.

import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type OverviewChart = {
  title: string;
  text: string;
  /** the chart's accessible summary */
  summary: string;
  /** the bars */
  series: Point[];
};

export type OverviewActivity = {
  title: string;
  text: string;
  events: Event[];
};

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 dashboard-overview
blocks/dashboard-overview.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.

import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type OverviewChart = {
  title: string;
  text: string;
  /** the chart's accessible summary */
  summary: string;
  /** the bars */
  series: Point[];
};

export type OverviewActivity = {
  title: string;
  text: string;
  events: Event[];
};
blocks/dashboard-overview.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. -->
<!--
  The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the
  activity side by side, stacked: one below the other), cols (2, 4), tone, density.
-->
<script lang="ts">
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type DashboardOverviewProps = {
  id: string;
  title: string;
  metrics: Metric[];
  chart: OverviewChart;
  activity: OverviewActivity;
  layout?: "split" | "stacked";
  cols?: "2" | "4";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Grid from "../compose/Grid.vue";
import Stack from "../compose/Stack.vue";
import BarChart from "../components/bar-chart.vue";
import Panel from "../components/panel.vue";
import SectionFrame from "../components/section-frame.vue";
import StatTile from "../components/stat-tile.vue";
import Timeline from "../components/timeline.vue";
import { tpl } from "../utils";

const {
  id,
  title,
  metrics,
  chart,
  activity,
  layout = "split",
  cols = "4",
  tone = "default",
  density = "default",
  landmarkLabel,
} = defineProps<DashboardOverviewProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :tone="tone" :density="density" :landmarkLabel="landmarkLabel">
    <Stack gap="6" align="stretch">
      <Grid
        v-if="((metrics?.length ?? 0) > 0)"
        :cols="(((cols as string) === '2') ? '1-2' : '1-4')"
        class="gap-4"
        data-slot="items"
      >
        <Box v-for="m in metrics" :key="m.id" data-slot="item">
          <StatTile :label="m.label" :value="m.value" :icon="m.icon" :hint="m.hint" />
        </Box>
      </Grid>
      <Grid :cols="(((layout as string) === 'split') ? '1-2' : '1')" class="items-stretch gap-4" data-slot="panels">
        <Panel
          v-if="((chart.series?.length ?? 0) > 0)"
          :title="chart.title"
          :description="chart.text"
          :id="tpl('{0}-chart', id)"
          class="h-full"
        >
          <BarChart :bars="chart.series" :label="chart.summary" :height="144" />
        </Panel>
        <Panel
          v-if="((activity.events?.length ?? 0) > 0)"
          :title="activity.title"
          :description="activity.text"
          :id="tpl('{0}-feed', id)"
          class="h-full"
        >
          <Timeline :items="activity.events" />
        </Panel>
      </Grid>
    </Stack>
  </SectionFrame>
</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 dashboard-overview
blocks/dashboard-overview.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.
/**
 * The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the
 * activity side by side, stacked: one below the other), cols (2, 4), tone, density.
 */
import { For, type JSX } from "solid-js";
import { Box, Grid, Stack } from "../compose";
import { BarChart } from "../components/bar-chart";
import { Panel } from "../components/panel";
import { SectionFrame } from "../components/section-frame";
import { StatTile } from "../components/stat-tile";
import { Timeline } from "../components/timeline";
import { tpl } from "../utils";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type DashboardOverviewProps = {
  id: string;
  title: string;
  metrics: Metric[];
  chart: OverviewChart;
  activity: OverviewActivity;
  layout?: "split" | "stacked";
  cols?: "2" | "4";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function DashboardOverview({
  id,
  title,
  metrics,
  chart,
  activity,
  layout = "split",
  cols = "4",
  tone = "default",
  density = "default",
  landmarkLabel,
}: DashboardOverviewProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
      <Stack gap="6" align="stretch">
        {((metrics?.length ?? 0) > 0) ? (
          <Grid cols={(((cols as string) === "2") ? "1-2" : "1-4")} class="gap-4" data-slot="items">
            <For each={metrics ?? []}>{(m) => (
              <Box data-slot="item">
                <StatTile label={m.label} value={m.value} icon={m.icon} hint={m.hint} />
              </Box>
            )}</For>
          </Grid>
        ) : null}
        <Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-stretch gap-4" data-slot="panels">
          {((chart.series?.length ?? 0) > 0) ? (
            <Panel title={chart.title} description={chart.text} id={tpl("{0}-chart", id)} class="h-full">
              <BarChart bars={chart.series} label={chart.summary} height={144} />
            </Panel>
          ) : null}
          {((activity.events?.length ?? 0) > 0) ? (
            <Panel title={activity.title} description={activity.text} id={tpl("{0}-feed", id)} class="h-full">
              <Timeline items={activity.events} />
            </Panel>
          ) : null}
        </Grid>
      </Stack>
    </SectionFrame>
  );
}
blocks/dashboard-overview.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.

import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";

export type OverviewChart = {
  title: string;
  text: string;
  /** the chart's accessible summary */
  summary: string;
  /** the bars */
  series: Point[];
};

export type OverviewActivity = {
  title: string;
  text: string;
  events: Event[];
};

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 dashboard-overview
blocks/dashboard-overview.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/dashboard-overview.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// DashboardOverviewProps are the props of DashboardOverview; the values are the JSON shapes of the TypeScript props.
type DashboardOverviewProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Metrics any `json:"metrics"`
	Chart any `json:"chart"`
	Activity any `json:"activity"`
	Layout any `json:"layout"`
	Cols any `json:"cols"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the activity side by side, stacked: one below the other), cols (2, 4), tone, density.
templ DashboardOverview(p DashboardOverviewProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vMetrics := p.Metrics }}
	{{ vChart := p.Chart }}
	{{ vActivity := p.Activity }}
	{{ vLayout := uiutils.Def(p.Layout, "split") }}
	{{ vCols := uiutils.Def(p.Cols, "4") }}
	{{ 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}) {
		@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{}}) {
			if uiutils.Gt(uiutils.Len(vMetrics), float64(0)) {
				@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "2")), "1-2", "1-4")), BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
					for _, vM := range uiutils.L(vMetrics) {
						@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "item")}}) {
							@StatTile(StatTileProps{Label: uiutils.Get(vM, "label"), Value: uiutils.Get(vM, "value"), Icon: uiutils.Get(vM, "icon"), Hint: uiutils.Get(vM, "hint")})
						}
					}
				}
			}
			@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "1-2", "1")), BoxProps: box.BoxProps{Class: "items-stretch gap-4", Attrs: uiutils.Attrs("data-slot", "panels")}}) {
				if uiutils.Gt(uiutils.Len(uiutils.Get(vChart, "series")), float64(0)) {
					@Panel(PanelProps{Title: uiutils.Get(vChart, "title"), Description: uiutils.Get(vChart, "text"), Id: uiutils.Tpl("{0}-chart", vId), Class: uiutils.Cnv("h-full")}) {
						@BarChart(BarChartProps{Bars: uiutils.Get(vChart, "series"), Label: uiutils.Get(vChart, "summary"), Height: float64(144)})
					}
				}
				if uiutils.Gt(uiutils.Len(uiutils.Get(vActivity, "events")), float64(0)) {
					@Panel(PanelProps{Title: uiutils.Get(vActivity, "title"), Description: uiutils.Get(vActivity, "text"), Id: uiutils.Tpl("{0}-feed", vId), Class: uiutils.Cnv("h-full")}) {
						@Timeline(TimelineProps{Items: uiutils.Get(vActivity, "events")})
					}
				}
			}
		}
	}
}

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 dashboard-overview
blocks/dashboard-overview.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/dashboard-overview.json
    The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the activity side by side, stacked: one below the other), cols (2, 4), tone, density.
    Props (p): id, title, metrics, chart, activity, layout, cols, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_metrics = (p.metrics ?? null) -%}
{%- set v_chart = (p.chart ?? null) -%}
{%- set v_activity = (p.activity ?? null) -%}
{%- set v_layout = (p.layout ?? 'split') -%}
{%- set v_cols = (p.cols ?? '4') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_7 -%}
  {%- set c_6 -%}
    {%- if og_t(og_gt(og_len(v_metrics), 0)) %}
      {%- set c_2 -%}
        {%- for v_m in og_l(v_metrics) %}
          {%- set c_1 -%}
            {{ include('blocks/stat-tile.html.twig', {'p': {'label': og_get(v_m, ['label']), 'value': og_get(v_m, ['value']), 'icon': og_get(v_m, ['icon']), 'hint': og_get(v_m, ['hint'])}}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Box.html.twig', {'attrs': og_attrs(['data-slot', 'item']), 'children': c_1}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_cols, '2')) ? '1-2' : '1-4')), 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_2}, with_context = false) }}
    {%- endif %}
    {%- set c_5 -%}
      {%- if og_t(og_gt(og_len(og_get(v_chart, ['series'])), 0)) %}
        {%- set c_3 -%}
          {{ include('blocks/bar-chart.html.twig', {'p': {'bars': og_get(v_chart, ['series']), 'label': og_get(v_chart, ['summary']), 'height': 144}}, with_context = false) }}
        {%- endset -%}
        {{ include('blocks/panel.html.twig', {'p': {'title': og_get(v_chart, ['title']), 'description': og_get(v_chart, ['text']), 'id': og_tpl('{0}-chart', [v_id]), 'className': og_cnv(['h-full'])}, 'children': og_markup(c_3)}, with_context = false) }}
      {%- endif %}
      {%- if og_t(og_gt(og_len(og_get(v_activity, ['events'])), 0)) %}
        {%- set c_4 -%}
          {{ include('blocks/timeline.html.twig', {'p': {'items': og_get(v_activity, ['events'])}}, with_context = false) }}
        {%- endset -%}
        {{ include('blocks/panel.html.twig', {'p': {'title': og_get(v_activity, ['title']), 'description': og_get(v_activity, ['text']), 'id': og_tpl('{0}-feed', [v_id]), 'className': og_cnv(['h-full'])}, 'children': og_markup(c_4)}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'split')) ? '1-2' : '1')), 'class': 'items-stretch gap-4', 'attrs': og_attrs(['data-slot', 'panels']), 'children': c_5}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}, with_context = false) }}

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 dashboard-overview
blocks/dashboard-overview.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/dashboard-overview.json
    The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the activity side by side, stacked: one below the other), cols (2, 4), tone, density.
    Props (p): id, title, metrics, chart, activity, layout, cols, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_metrics = ($p['metrics'] ?? null)}
{var $v_chart = ($p['chart'] ?? null)}
{var $v_activity = ($p['activity'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'split')}
{var $v_cols = ($p['cols'] ?? '4')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_7}
  {capture $c_6}
    {if og_t(og_gt(og_len($v_metrics), 0))}
      {capture $c_2}
        {foreach og_l($v_metrics) as $v_m}
          {capture $c_1}
            {=og_include('blocks/stat-tile.latte', ['p' => ['label' => og_get($v_m, ['label']), 'value' => og_get($v_m, ['value']), 'icon' => og_get($v_m, ['icon']), 'hint' => og_get($v_m, ['hint'])]])|noescape}
          {/capture}
          {=og_include('compose/Box.latte', ['attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_1])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_cols, '2')) ? '1-2' : '1-4')), 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_2])|noescape}
    {/if}
    {capture $c_5}
      {if og_t(og_gt(og_len(og_get($v_chart, ['series'])), 0))}
        {capture $c_3}
          {=og_include('blocks/bar-chart.latte', ['p' => ['bars' => og_get($v_chart, ['series']), 'label' => og_get($v_chart, ['summary']), 'height' => 144]])|noescape}
        {/capture}
        {=og_include('blocks/panel.latte', ['p' => ['title' => og_get($v_chart, ['title']), 'description' => og_get($v_chart, ['text']), 'id' => og_tpl('{0}-chart', [$v_id]), 'className' => og_cnv(['h-full'])], 'children' => og_markup($c_3)])|noescape}
      {/if}
      {if og_t(og_gt(og_len(og_get($v_activity, ['events'])), 0))}
        {capture $c_4}
          {=og_include('blocks/timeline.latte', ['p' => ['items' => og_get($v_activity, ['events'])]])|noescape}
        {/capture}
        {=og_include('blocks/panel.latte', ['p' => ['title' => og_get($v_activity, ['title']), 'description' => og_get($v_activity, ['text']), 'id' => og_tpl('{0}-feed', [$v_id]), 'className' => og_cnv(['h-full'])], 'children' => og_markup($c_4)])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'split')) ? '1-2' : '1')), 'class' => 'items-stretch gap-4', 'attrs' => og_attrs(['data-slot', 'panels']), 'children' => (string) $c_5])|noescape}
  {/capture}
  {=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_7)])|noescape}

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 dashboard-overview
blocks/dashboard-overview.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/dashboard-overview.json
    The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the activity side by side, stacked: one below the other), cols (2, 4), tone, density.
    Props (p): id, title, metrics, chart, activity, layout, cols, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_metrics = og_def(p['metrics'], none) -%}
{%- set v_chart = og_def(p['chart'], none) -%}
{%- set v_activity = og_def(p['activity'], none) -%}
{%- set v_layout = og_def(p['layout'], 'split') -%}
{%- set v_cols = og_def(p['cols'], '4') -%}
{%- 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_7 -%}
  {%- set c_6 -%}
    {%- if og_t(og_gt(og_len(v_metrics), 0)) %}
      {%- set c_2 -%}
        {%- for v_m in og_l(v_metrics) %}
          {%- set c_1 -%}
            {{ og_include('blocks/stat-tile.html.j2', {'p': {'label': og_get(v_m, ['label']), 'value': og_get(v_m, ['value']), 'icon': og_get(v_m, ['icon']), 'hint': og_get(v_m, ['hint'])}}) }}
          {%- endset -%}
          {{ og_include('compose/box.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_1}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-2' if og_t(og_eq(v_cols, '2')) else '1-4')), 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_2}) }}
    {%- endif %}
    {%- set c_5 -%}
      {%- if og_t(og_gt(og_len(og_get(v_chart, ['series'])), 0)) %}
        {%- set c_3 -%}
          {{ og_include('blocks/bar-chart.html.j2', {'p': {'bars': og_get(v_chart, ['series']), 'label': og_get(v_chart, ['summary']), 'height': 144}}) }}
        {%- endset -%}
        {{ og_include('blocks/panel.html.j2', {'p': {'title': og_get(v_chart, ['title']), 'description': og_get(v_chart, ['text']), 'id': og_tpl('{0}-chart', [v_id]), 'className': og_cnv(['h-full'])}, 'children': og_markup(c_3)}) }}
      {%- endif %}
      {%- if og_t(og_gt(og_len(og_get(v_activity, ['events'])), 0)) %}
        {%- set c_4 -%}
          {{ og_include('blocks/timeline.html.j2', {'p': {'items': og_get(v_activity, ['events'])}}) }}
        {%- endset -%}
        {{ og_include('blocks/panel.html.j2', {'p': {'title': og_get(v_activity, ['title']), 'description': og_get(v_activity, ['text']), 'id': og_tpl('{0}-feed', [v_id]), 'className': og_cnv(['h-full'])}, 'children': og_markup(c_4)}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-2' if og_t(og_eq(v_layout, 'split')) else '1')), 'Class': 'items-stretch gap-4', 'Attrs': og_attrs(['data-slot', 'panels'])}, 'children': c_5}) }}
  {%- endset -%}
  {{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch'}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}) }}

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.

The first screen of an app: counters, a chart and recent activity. Axes: layout (split: the chart and the activity side by side, stacked: one below the other), cols (2, 4), tone, density.

Props of DashboardOverview
PropTypeDefault Description
id (required)string-
title (required)string-
metrics (required)Metric[]-
chart (required)OverviewChart-
activity (required)OverviewActivity-
layout "split" | "stacked""split"
cols "2" | "4""4"
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

Used in