Skip to content
ui8kit

block / dashboard

Chart Panel

Orders per day as bars or meters.

Install

npx ui8kit add chart-panel

Pulls in: bar-chart, block, compose, container, empty-state, kit-box, meter-row, panel, stack, utils

Preview

Orders this week

Orders per day over the last seven days.

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 chart-panel
blocks/chart-panel.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 a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart
  (bars, meters), size (default, compact), tone (default, muted).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Point } from "./chart-panel.types";

  export type ChartPanelProps = {
    id: string;
    title: string;
    text: string;
    series: Point[];
    empty?: string;
    summary: string;
    percent: string;
    chart?: "bars" | "meters";
    size?: "default" | "compact";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Container from "../compose/Container.svelte";
  import Stack from "../compose/Stack.svelte";
  import BarChart from "../components/bar-chart.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import MeterRow from "../components/meter-row.svelte";
  import Panel from "../components/panel.svelte";
  import { tpl } from "../utils";

  let {
    id,
    title,
    text,
    series,
    empty = "",
    summary,
    percent,
    chart = "bars",
    size = "default",
    tone = "default",
    landmarkLabel,
  }: ChartPanelProps = $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 ((series?.length ?? 0) === 0)}
        <EmptyState icon="chart-column" title={empty} />
      {:else if ((chart as string) === "bars")}
        <BarChart bars={series} label={summary} height={(((size as string) === "compact") ? 96 : 176)} />
      {:else}
        <Stack gap={(((size as string) === "compact") ? "0" : "2")} align="stretch" data-slot="items">
          {#each series as s (s.id)}
            <MeterRow label={s.label} value={s.value} caption={tpl(percent, s.value)} />
          {/each}
        </Stack>
      {/if}
    </Panel>
  </Container>
</Block>
blocks/chart-panel.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 Point = {
  id: string;
  label: string;
  value: number;
};

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 chart-panel
blocks/chart-panel.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 a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart
 * (bars, meters), size (default, compact), tone (default, muted).
 */
import { type ReactNode } from "react";
import { Block, Container, Stack } from "../compose";
import { BarChart } from "../components/bar-chart";
import { EmptyState } from "../components/empty-state";
import { MeterRow } from "../components/meter-row";
import { Panel } from "../components/panel";
import { tpl } from "../utils";
import type { Point } from "./chart-panel.types";

export type ChartPanelProps = {
  id: string;
  title: string;
  text: string;
  series: Point[];
  empty?: string;
  summary: string;
  percent: string;
  chart?: "bars" | "meters";
  size?: "default" | "compact";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function ChartPanel({
  id,
  title,
  text,
  series,
  empty = "",
  summary,
  percent,
  chart = "bars",
  size = "default",
  tone = "default",
  landmarkLabel,
}: ChartPanelProps) {
  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" : "")}>
          {((series?.length ?? 0) === 0) ? (
            <EmptyState icon="chart-column" title={empty} />
          ) : ((chart as string) === "bars") ? (
            <BarChart bars={series} label={summary} height={(((size as string) === "compact") ? 96 : 176)} />
          ) : (
            <Stack gap={(((size as string) === "compact") ? "0" : "2")} align="stretch" data-slot="items">
              {(series ?? []).map((s) => (
                <MeterRow key={s.id} label={s.label} value={s.value} caption={tpl(percent, s.value)} />
              ))}
            </Stack>
          )}
        </Panel>
      </Container>
    </Block>
  );
}
blocks/chart-panel.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 Point = {
  id: string;
  label: string;
  value: number;
};

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 chart-panel
blocks/chart-panel.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 Point = {
  id: string;
  label: string;
  value: number;
};
blocks/chart-panel.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 a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart
  (bars, meters), size (default, compact), tone (default, muted).
-->
<script lang="ts">
import type { Point } from "./chart-panel.types";

export type ChartPanelProps = {
  id: string;
  title: string;
  text: string;
  series: Point[];
  empty?: string;
  summary: string;
  percent: string;
  chart?: "bars" | "meters";
  size?: "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 Stack from "../compose/Stack.vue";
import BarChart from "../components/bar-chart.vue";
import EmptyState from "../components/empty-state.vue";
import MeterRow from "../components/meter-row.vue";
import Panel from "../components/panel.vue";
import { tpl } from "../utils";

const {
  id,
  title,
  text,
  series,
  empty = "",
  summary,
  percent,
  chart = "bars",
  size = "default",
  tone = "default",
  landmarkLabel,
} = defineProps<ChartPanelProps>();
</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="((series?.length ?? 0) === 0)" icon="chart-column" :title="empty" />
        <BarChart
          v-else-if="((chart as string) === 'bars')"
          :bars="series"
          :label="summary"
          :height="(((size as string) === 'compact') ? 96 : 176)"
        />
        <Stack v-else :gap="(((size as string) === 'compact') ? '0' : '2')" align="stretch" data-slot="items">
          <MeterRow
            v-for="s in series"
            :key="s.id"
            :label="s.label"
            :value="s.value"
            :caption="tpl(percent, s.value)"
          />
        </Stack>
      </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 chart-panel
blocks/chart-panel.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 a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart
 * (bars, meters), size (default, compact), tone (default, muted).
 */
import { For, type JSX } from "solid-js";
import { Block, Container, Stack } from "../compose";
import { BarChart } from "../components/bar-chart";
import { EmptyState } from "../components/empty-state";
import { MeterRow } from "../components/meter-row";
import { Panel } from "../components/panel";
import { tpl } from "../utils";
import type { Point } from "./chart-panel.types";

export type ChartPanelProps = {
  id: string;
  title: string;
  text: string;
  series: Point[];
  empty?: string;
  summary: string;
  percent: string;
  chart?: "bars" | "meters";
  size?: "default" | "compact";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function ChartPanel({
  id,
  title,
  text,
  series,
  empty = "",
  summary,
  percent,
  chart = "bars",
  size = "default",
  tone = "default",
  landmarkLabel,
}: ChartPanelProps) {
  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" : "")}>
          {((series?.length ?? 0) === 0) ? (
            <EmptyState icon="chart-column" title={empty} />
          ) : ((chart as string) === "bars") ? (
            <BarChart bars={series} label={summary} height={(((size as string) === "compact") ? 96 : 176)} />
          ) : (
            <Stack gap={(((size as string) === "compact") ? "0" : "2")} align="stretch" data-slot="items">
              <For each={series ?? []}>{(s) => (
                <MeterRow label={s.label} value={s.value} caption={tpl(percent, s.value)} />
              )}</For>
            </Stack>
          )}
        </Panel>
      </Container>
    </Block>
  );
}
blocks/chart-panel.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 Point = {
  id: string;
  label: string;
  value: number;
};

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 chart-panel
blocks/chart-panel.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/chart-panel.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"
)

// ChartPanelProps are the props of ChartPanel; the values are the JSON shapes of the TypeScript props.
type ChartPanelProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Series any `json:"series"`
	Empty any `json:"empty"`
	Summary any `json:"summary"`
	Percent any `json:"percent"`
	Chart any `json:"chart"`
	Size any `json:"size"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A panel with a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart (bars, meters), size (default, compact), tone (default, muted).
templ ChartPanel(p ChartPanelProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vSeries := p.Series }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vSummary := p.Summary }}
	{{ vPercent := p.Percent }}
	{{ vChart := uiutils.Def(p.Chart, "bars") }}
	{{ vSize := uiutils.Def(p.Size, "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(vSeries), float64(0)) {
					@EmptyState(EmptyStateProps{Icon: "chart-column", Title: vEmpty})
				} else if uiutils.Eq(vChart, "bars") {
					@BarChart(BarChartProps{Bars: vSeries, Label: vSummary, Height: uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "compact")), float64(96), float64(176))})
				} else {
					@compose.Stack(compose.StackProps{Gap: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "compact")), "0", "2")), Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "items")}}) {
						for _, vS := range uiutils.L(vSeries) {
							@MeterRow(MeterRowProps{Label: uiutils.Get(vS, "label"), Value: uiutils.Get(vS, "value"), Caption: uiutils.Tpl(vPercent, uiutils.Get(vS, "value"))})
						}
					}
				}
			}
		}
	}
}

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 chart-panel
blocks/chart-panel.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/chart-panel.json
    A panel with a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart (bars, meters), size (default, compact), tone (default, muted).
    Props (p): id, title, text, series, empty, summary, percent, chart, size, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_series = (p.series ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_summary = (p.summary ?? null) -%}
{%- set v_percent = (p.percent ?? null) -%}
{%- set v_chart = (p.chart ?? 'bars') -%}
{%- set v_size = (p.size ?? 'default') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_4 -%}
  {%- set c_3 -%}
    {%- set c_2 -%}
      {%- if og_t(og_eq(og_len(v_series), 0)) %}
        {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'chart-column', 'title': v_empty}}, with_context = false) }}
      {%- elseif og_t(og_eq(v_chart, 'bars')) %}
        {{ include('blocks/bar-chart.html.twig', {'p': {'bars': v_series, 'label': v_summary, 'height': (og_t(og_eq(v_size, 'compact')) ? 96 : 176)}}, with_context = false) }}
      {%- else %}
        {%- set c_1 -%}
          {%- for v_s in og_l(v_series) %}
            {{ include('blocks/meter-row.html.twig', {'p': {'label': og_get(v_s, ['label']), 'value': og_get(v_s, ['value']), 'caption': og_tpl(v_percent, [og_get(v_s, ['value'])])}}, with_context = false) }}
          {%- endfor %}
        {%- endset -%}
        {{ include('compose/Stack.html.twig', {'gap': og_s((og_t(og_eq(v_size, 'compact')) ? '0' : '2')), 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_1}, 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_2)}, 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_3}, 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_4}, 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 chart-panel
blocks/chart-panel.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/chart-panel.json
    A panel with a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart (bars, meters), size (default, compact), tone (default, muted).
    Props (p): id, title, text, series, empty, summary, percent, chart, size, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_series = ($p['series'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_summary = ($p['summary'] ?? null)}
{var $v_percent = ($p['percent'] ?? null)}
{var $v_chart = ($p['chart'] ?? 'bars')}
{var $v_size = ($p['size'] ?? 'default')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_4}
  {capture $c_3}
    {capture $c_2}
      {if og_t(og_eq(og_len($v_series), 0))}
        {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'chart-column', 'title' => $v_empty]])|noescape}
      {elseif og_t(og_eq($v_chart, 'bars'))}
        {=og_include('blocks/bar-chart.latte', ['p' => ['bars' => $v_series, 'label' => $v_summary, 'height' => (og_t(og_eq($v_size, 'compact')) ? 96 : 176)]])|noescape}
      {else}
        {capture $c_1}
          {foreach og_l($v_series) as $v_s}
            {=og_include('blocks/meter-row.latte', ['p' => ['label' => og_get($v_s, ['label']), 'value' => og_get($v_s, ['value']), 'caption' => og_tpl($v_percent, [og_get($v_s, ['value'])])]])|noescape}
          {/foreach}
        {/capture}
        {=og_include('compose/Stack.latte', ['gap' => og_s((og_t(og_eq($v_size, 'compact')) ? '0' : '2')), 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_1])|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_2)])|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_3])|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_4])|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 chart-panel
blocks/chart-panel.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/chart-panel.json
    A panel with a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart (bars, meters), size (default, compact), tone (default, muted).
    Props (p): id, title, text, series, empty, summary, percent, chart, size, 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_series = og_def(p['series'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_summary = og_def(p['summary'], none) -%}
{%- set v_percent = og_def(p['percent'], none) -%}
{%- set v_chart = og_def(p['chart'], 'bars') -%}
{%- set v_size = og_def(p['size'], 'default') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_4 -%}
  {%- set c_3 -%}
    {%- set c_2 -%}
      {%- if og_t(og_eq(og_len(v_series), 0)) %}
        {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'chart-column', 'title': v_empty}}) }}
      {%- elif og_t(og_eq(v_chart, 'bars')) %}
        {{ og_include('blocks/bar-chart.html.j2', {'p': {'bars': v_series, 'label': v_summary, 'height': (96 if og_t(og_eq(v_size, 'compact')) else 176)}}) }}
      {%- else %}
        {%- set c_1 -%}
          {%- for v_s in og_l(v_series) %}
            {{ og_include('blocks/meter-row.html.j2', {'p': {'label': og_get(v_s, ['label']), 'value': og_get(v_s, ['value']), 'caption': og_tpl(v_percent, [og_get(v_s, ['value'])])}}) }}
          {%- endfor %}
        {%- endset -%}
        {{ og_include('compose/stack.html.j2', {'p': {'Gap': og_s(('0' if og_t(og_eq(v_size, 'compact')) else '2')), 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_1}) }}
      {%- 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_2)}) }}
  {%- 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_3}) }}
{%- 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_4}) }}

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 a chart of one series: vertical bars with captions, or meter rows with a percent. Axes: chart (bars, meters), size (default, compact), tone (default, muted).

Props of ChartPanel
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-the sentence under the title
series (required)Point[]-
empty string""the text of the empty state (no records), from the dictionary
summary (required)string-the chart's accessible summary
percent (required)string-template of a meter caption, e.g. `{0}%`
chart "bars" | "meters""bars"
size "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