Empty Panel
A list with nothing in it, with an optional action.
Install
npx ui8kit add empty-panelPulls in: block, button, compose, container, empty-state, kit-box, kit-button, kit-text, media-frame, stack, text, title, utils
Preview
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 empty-panel<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain.
Axes: layout (card, plain), actions (button, none), size (default, compact).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type EmptyPanelProps = {
id: string;
title: string;
text: string;
icon?: string;
cta?: string;
ctaHref?: string;
layout?: "card" | "plain";
actions?: "button" | "none";
visual?: "icon" | "image";
size?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Button from "../compose/Button.svelte";
import Container from "../compose/Container.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 MediaFrame from "../components/media-frame.svelte";
import { cn, urlOf } from "../utils";
let {
id,
title,
text,
icon = "inbox",
cta,
ctaHref,
layout = "card",
actions = "button",
visual = "icon",
size = "default",
image,
imageAlt,
landmarkLabel,
}: EmptyPanelProps = $props();
</script>
<Block tag="section" aria-label={(landmarkLabel ?? title)} data-slot="empty">
<Container
class={cn("mx-auto w-full max-w-6xl px-4", (((size as string) === "compact") ? "py-4" : "py-8"))}
data-slot="container"
>
{#if ((visual as string) === "image")}
<Stack gap="4" align="center" class="mx-auto max-w-md text-center" data-slot="empty-visual">
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" class="w-full max-w-xs" />
<Title as={2} size="2xl" weight="bold">
{title}
</Title>
<Text size="sm" class="text-muted-foreground">
{text}
</Text>
{#if ((actions as string) === "button")}
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
{/if}
</Stack>
{:else}
<EmptyState
icon={icon}
title={title}
text={text}
class={cn(
"mx-auto max-w-xl",
(((layout as string) === "plain") ? "bg-transparent inset-ring-0" : ""),
(((size as string) === "compact") ? "py-6" : "")
)}
>
{#snippet action()}
{#if ((actions as string) === "button")}
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
{/if}
{/snippet}
</EmptyState>
{/if}
</Container>
</Block>
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 empty-panel// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain.
* Axes: layout (card, plain), actions (button, none), size (default, compact).
*/
import { type ReactNode } from "react";
import { Block, Button, Container, Stack, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { cn, urlOf } from "../utils";
export type EmptyPanelProps = {
id: string;
title: string;
text: string;
icon?: string;
cta?: string;
ctaHref?: string;
layout?: "card" | "plain";
actions?: "button" | "none";
visual?: "icon" | "image";
size?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function EmptyPanel({
id,
title,
text,
icon = "inbox",
cta,
ctaHref,
layout = "card",
actions = "button",
visual = "icon",
size = "default",
image,
imageAlt,
landmarkLabel,
}: EmptyPanelProps) {
return (
<Block tag="section" aria-label={(landmarkLabel ?? title)} data-slot="empty">
<Container
className={cn(
"mx-auto w-full max-w-6xl px-4",
(((size as string) === "compact") ? "py-4" : "py-8")
)}
data-slot="container"
>
{((visual as string) === "image") ? (
<Stack gap="4" align="center" className="mx-auto max-w-md text-center" data-slot="empty-visual">
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" className="w-full max-w-xs" />
<Title as={2} size="2xl" weight="bold">
{title}
</Title>
<Text size="sm" className="text-muted-foreground">
{text}
</Text>
{((actions as string) === "button") ? (
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
) : null}
</Stack>
) : (
<EmptyState
icon={icon}
title={title}
text={text}
className={cn(
"mx-auto max-w-xl",
(((layout as string) === "plain") ? "bg-transparent inset-ring-0" : ""),
(((size as string) === "compact") ? "py-6" : "")
)}
action={(
<>
{((actions as string) === "button") ? (
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
) : null}
</>
)}
/>
)}
</Container>
</Block>
);
}
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 empty-panel<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain.
Axes: layout (card, plain), actions (button, none), size (default, compact).
-->
<script lang="ts">
export type EmptyPanelProps = {
id: string;
title: string;
text: string;
icon?: string;
cta?: string;
ctaHref?: string;
layout?: "card" | "plain";
actions?: "button" | "none";
visual?: "icon" | "image";
size?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Button from "../compose/Button.vue";
import Container from "../compose/Container.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 MediaFrame from "../components/media-frame.vue";
import { cn, urlOf } from "../utils";
const {
id,
title,
text,
icon = "inbox",
cta,
ctaHref,
layout = "card",
actions = "button",
visual = "icon",
size = "default",
image,
imageAlt,
landmarkLabel,
} = defineProps<EmptyPanelProps>();
</script>
<template>
<Block tag="section" :aria-label="(landmarkLabel ?? title)" data-slot="empty">
<Container
:class="cn('mx-auto w-full max-w-6xl px-4', (((size as string) === 'compact') ? 'py-4' : 'py-8'))"
data-slot="container"
>
<Stack
v-if="((visual as string) === 'image')"
gap="4"
align="center"
class="mx-auto max-w-md text-center"
data-slot="empty-visual"
>
<MediaFrame :alt="(imageAlt ? imageAlt : title)" :src="image" ratio="4/3" class="w-full max-w-xs" />
<Title :as="2" size="2xl" weight="bold">
{{ title }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ text }}
</Text>
<Button v-if="((actions as string) === 'button')" variant="default" size="sm" :href="urlOf(ctaHref)">
{{ cta }}
</Button>
</Stack>
<EmptyState v-else
:icon="icon"
:title="title"
:text="text"
:class="cn(
'mx-auto max-w-xl',
(((layout as string) === 'plain') ? 'bg-transparent inset-ring-0' : ''),
(((size as string) === 'compact') ? 'py-6' : '')
)"
>
<template #action>
<Button v-if="((actions as string) === 'button')" variant="default" size="sm" :href="urlOf(ctaHref)">
{{ cta }}
</Button>
</template>
</EmptyState>
</Container>
</Block>
</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 empty-panel// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain.
* Axes: layout (card, plain), actions (button, none), size (default, compact).
*/
import { type JSX } from "solid-js";
import { Block, Button, Container, Stack, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { cn, urlOf } from "../utils";
export type EmptyPanelProps = {
id: string;
title: string;
text: string;
icon?: string;
cta?: string;
ctaHref?: string;
layout?: "card" | "plain";
actions?: "button" | "none";
visual?: "icon" | "image";
size?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function EmptyPanel({
id,
title,
text,
icon = "inbox",
cta,
ctaHref,
layout = "card",
actions = "button",
visual = "icon",
size = "default",
image,
imageAlt,
landmarkLabel,
}: EmptyPanelProps) {
return (
<Block tag="section" aria-label={(landmarkLabel ?? title)} data-slot="empty">
<Container
class={cn("mx-auto w-full max-w-6xl px-4", (((size as string) === "compact") ? "py-4" : "py-8"))}
data-slot="container"
>
{((visual as string) === "image") ? (
<Stack gap="4" align="center" class="mx-auto max-w-md text-center" data-slot="empty-visual">
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" class="w-full max-w-xs" />
<Title as={2} size="2xl" weight="bold">
{title}
</Title>
<Text size="sm" class="text-muted-foreground">
{text}
</Text>
{((actions as string) === "button") ? (
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
) : null}
</Stack>
) : (
<EmptyState
icon={icon}
title={title}
text={text}
class={cn(
"mx-auto max-w-xl",
(((layout as string) === "plain") ? "bg-transparent inset-ring-0" : ""),
(((size as string) === "compact") ? "py-6" : "")
)}
action={(
<>
{((actions as string) === "button") ? (
<Button variant="default" size="sm" href={urlOf(ctaHref)}>
{cta}
</Button>
) : null}
</>
)}
/>
)}
</Container>
</Block>
);
}
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 empty-panel// 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/empty-panel.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/ui/button"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// EmptyPanelProps are the props of EmptyPanel; the values are the JSON shapes of the TypeScript props.
type EmptyPanelProps struct {
Id any `json:"id"`
Title any `json:"title"`
Text any `json:"text"`
Icon any `json:"icon"`
Cta any `json:"cta"`
CtaHref any `json:"ctaHref"`
Layout any `json:"layout"`
Actions any `json:"actions"`
Visual any `json:"visual"`
Size any `json:"size"`
Image any `json:"image"`
ImageAlt any `json:"imageAlt"`
LandmarkLabel any `json:"landmarkLabel"`
}
// An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain. Axes: layout (card, plain), actions (button, none), size (default, compact).
templ EmptyPanel(p EmptyPanelProps) {
{{ vTitle := p.Title }}
{{ vText := p.Text }}
{{ vIcon := uiutils.Def(p.Icon, "inbox") }}
{{ vCta := p.Cta }}
{{ vCtaHref := p.CtaHref }}
{{ vLayout := uiutils.Def(p.Layout, "card") }}
{{ vActions := uiutils.Def(p.Actions, "button") }}
{{ vVisual := uiutils.Def(p.Visual, "icon") }}
{{ vSize := uiutils.Def(p.Size, "default") }}
{{ vImage := p.Image }}
{{ vImageAlt := p.ImageAlt }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vLandmarkLabel, vTitle), "data-slot", "empty")}}) {
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "compact")), "py-4", "py-8"))), Attrs: uiutils.Attrs("data-slot", "container")}}) {
if uiutils.Eq(vVisual, "image") {
@compose.Stack(compose.StackProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Class: "mx-auto max-w-md text-center", Attrs: uiutils.Attrs("data-slot", "empty-visual")}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: "4/3", Class: uiutils.Cnv("w-full max-w-xs")})
@compose.Title(compose.TitleProps{As: "2", Size: "2xl", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(vTitle) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(vText) }
}
if uiutils.Eq(vActions, "button") {
@compose.Button(compose.ButtonProps{Variant: "default", Size: "sm", ButtonProps: button.ButtonProps{Href: uiutils.URL(vCtaHref, false)}}) {
{ uiutils.Text(vCta) }
}
}
}
} else {
@EmptyState(EmptyStateProps{Icon: vIcon, Title: vTitle, Text: vText, Class: uiutils.Cnv(uiutils.Cnv("mx-auto max-w-xl", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "plain")), "bg-transparent inset-ring-0", ""), uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "compact")), "py-6", ""))), Action: emptyPanelFill1(p, vCta, vCtaHref, vActions)})
}
}
}
}
templ emptyPanelFill1(p EmptyPanelProps, vCta any, vCtaHref any, vActions any) {
if uiutils.Eq(vActions, "button") {
@compose.Button(compose.ButtonProps{Variant: "default", Size: "sm", ButtonProps: button.ButtonProps{Href: uiutils.URL(vCtaHref, false)}}) {
{ uiutils.Text(vCta) }
}
}
}
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 empty-panel{#- 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/empty-panel.json
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain. Axes: layout (card, plain), actions (button, none), size (default, compact).
Props (p): id, title, text, icon, cta, ctaHref, layout, actions, visual, size, image, imageAlt, landmarkLabel. -#}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_icon = (p.icon ?? 'inbox') -%}
{%- set v_cta = (p.cta ?? null) -%}
{%- set v_ctaHref = (p.ctaHref ?? null) -%}
{%- set v_layout = (p.layout ?? 'card') -%}
{%- set v_actions = (p.actions ?? 'button') -%}
{%- set v_visual = (p.visual ?? 'icon') -%}
{%- set v_size = (p.size ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_8 -%}
{%- set c_7 -%}
{%- if og_t(og_eq(v_visual, 'image')) %}
{%- set c_4 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image, 'ratio': '4/3', 'className': og_cnv(['w-full max-w-xs'])}}, with_context = false) }}
{%- set c_1 -%}
{{ og_text(v_title) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 2, 'size': '2xl', 'weight': 'bold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(v_text) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- if og_t(og_eq(v_actions, 'button')) %}
{%- set c_3 -%}
{{ og_text(v_cta) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'sm', 'href': og_url(og_s(v_ctaHref)), 'children': c_3}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'center', 'class': 'mx-auto max-w-md text-center', 'attrs': og_attrs(['data-slot', 'empty-visual']), 'children': c_4}, with_context = false) }}
{%- else %}
{%- set f_5 -%}
{%- if og_t(og_eq(v_actions, 'button')) %}
{%- set c_6 -%}
{{ og_text(v_cta) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'sm', 'href': og_url(og_s(v_ctaHref)), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': v_icon, 'title': v_title, 'text': v_text, 'className': og_cnv([og_cnv(['mx-auto max-w-xl', (og_t(og_eq(v_layout, 'plain')) ? 'bg-transparent inset-ring-0' : ''), (og_t(og_eq(v_size, 'compact')) ? 'py-6' : '')])]), 'action': og_markup(f_5)}}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', (og_t(og_eq(v_size, 'compact')) ? 'py-4' : 'py-8')])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_title]), 'data-slot', 'empty']), 'children': c_8}, 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 empty-panel{* 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/empty-panel.json
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain. Axes: layout (card, plain), actions (button, none), size (default, compact).
Props (p): id, title, text, icon, cta, ctaHref, layout, actions, visual, size, image, imageAlt, landmarkLabel. *}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_icon = ($p['icon'] ?? 'inbox')}
{var $v_cta = ($p['cta'] ?? null)}
{var $v_ctaHref = ($p['ctaHref'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'card')}
{var $v_actions = ($p['actions'] ?? 'button')}
{var $v_visual = ($p['visual'] ?? 'icon')}
{var $v_size = ($p['size'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_8}
{capture $c_7}
{if og_t(og_eq($v_visual, 'image'))}
{capture $c_4}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => '4/3', 'className' => og_cnv(['w-full max-w-xs'])]])|noescape}
{capture $c_1}
{=og_text($v_title)}
{/capture}
{=og_include('compose/Title.latte', ['as' => 2, 'size' => '2xl', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text($v_text)}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{if og_t(og_eq($v_actions, 'button'))}
{capture $c_3}
{=og_text($v_cta)}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'sm', 'href' => og_url(og_s($v_ctaHref)), 'children' => (string) $c_3])|noescape}
{/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'center', 'class' => 'mx-auto max-w-md text-center', 'attrs' => og_attrs(['data-slot', 'empty-visual']), 'children' => (string) $c_4])|noescape}
{else}
{capture $f_5}
{if og_t(og_eq($v_actions, 'button'))}
{capture $c_6}
{=og_text($v_cta)}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'sm', 'href' => og_url(og_s($v_ctaHref)), 'children' => (string) $c_6])|noescape}
{/if}
{/capture}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => $v_icon, 'title' => $v_title, 'text' => $v_text, 'className' => og_cnv([og_cnv(['mx-auto max-w-xl', (og_t(og_eq($v_layout, 'plain')) ? 'bg-transparent inset-ring-0' : ''), (og_t(og_eq($v_size, 'compact')) ? 'py-6' : '')])]), 'action' => og_markup($f_5)]])|noescape}
{/if}
{/capture}
{=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', (og_t(og_eq($v_size, 'compact')) ? 'py-4' : 'py-8')])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'attrs' => og_attrs(['aria-label', og_coalesce([$v_landmarkLabel, $v_title]), 'data-slot', 'empty']), 'children' => (string) $c_8])|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 empty-panel{#- 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/empty-panel.json
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain. Axes: layout (card, plain), actions (button, none), size (default, compact).
Props (p): id, title, text, icon, cta, ctaHref, layout, actions, visual, size, image, imageAlt, landmarkLabel. -#}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_icon = og_def(p['icon'], 'inbox') -%}
{%- set v_cta = og_def(p['cta'], none) -%}
{%- set v_ctaHref = og_def(p['ctaHref'], none) -%}
{%- set v_layout = og_def(p['layout'], 'card') -%}
{%- set v_actions = og_def(p['actions'], 'button') -%}
{%- set v_visual = og_def(p['visual'], 'icon') -%}
{%- set v_size = og_def(p['size'], 'default') -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_imageAlt = og_def(p['imageAlt'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_8 -%}
{%- set c_7 -%}
{%- if og_t(og_eq(v_visual, 'image')) %}
{%- set c_4 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'src': v_image, 'ratio': '4/3', 'className': og_cnv(['w-full max-w-xs'])}}) }}
{%- set c_1 -%}
{{ og_text(v_title) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': '2xl', 'Weight': 'bold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(v_text) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- if og_t(og_eq(v_actions, 'button')) %}
{%- set c_3 -%}
{{ og_text(v_cta) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'sm', 'Href': og_url(og_s(v_ctaHref))}, 'children': c_3}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Class': 'mx-auto max-w-md text-center', 'Attrs': og_attrs(['data-slot', 'empty-visual'])}, 'children': c_4}) }}
{%- else %}
{%- set f_5 -%}
{%- if og_t(og_eq(v_actions, 'button')) %}
{%- set c_6 -%}
{{ og_text(v_cta) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'sm', 'Href': og_url(og_s(v_ctaHref))}, 'children': c_6}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': v_icon, 'title': v_title, 'text': v_text, 'className': og_cnv([og_cnv(['mx-auto max-w-xl', ('bg-transparent inset-ring-0' if og_t(og_eq(v_layout, 'plain')) else ''), ('py-6' if og_t(og_eq(v_size, 'compact')) else '')])]), 'action': og_markup(f_5)}}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', ('py-4' if og_t(og_eq(v_size, 'compact')) else 'py-8')])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_title]), 'data-slot', 'empty'])}, 'children': c_8}) }}
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.
An empty list or an empty search: a round icon, a title, a hint and an optional action, in a card or plain. Axes: layout (card, plain), actions (button, none), size (default, compact).
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| text (required) | string | - | |
| icon | string | "inbox" | Lucide name |
| cta | string | - | text of the action |
| ctaHref | string | - | |
| layout | "card" | "plain" | "card" | |
| actions | "button" | "none" | "button" | |
| visual | "icon" | "image" | "icon" | image: a picture instead of the round icon |
| size | "default" | "compact" | "default" | |
| image | string | - | address of the picture (an https URL or a path); none: the placeholder |
| imageAlt | string | - | alt text of the picture; none: the title |
| 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 |