Skip to content
ui8kit

block / dashboard

Skeleton Layout

Grey blocks in the shape of what is coming: cards, a list or an article.

Install

npx ui8kit add skeleton-layout

Pulls in: block, compose, grid, group, kit-box, section-frame, skeleton, stack, utils

Preview

Loading the page

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 skeleton-layout
blocks/skeleton-layout.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 loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or
  an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content
  is loading. The shimmer itself belongs to the Skeleton part.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Line } from "./skeleton-layout.types";

  export type SkeletonLayoutProps = {
    id: string;
    title: string;
    label: string;
    lines: Line[];
    shape?: "cards" | "list" | "article";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Grid from "../compose/Grid.svelte";
  import Group from "../compose/Group.svelte";
  import Skeleton from "../compose/Skeleton.svelte";
  import Stack from "../compose/Stack.svelte";
  import SectionFrame from "../components/section-frame.svelte";

  let {
    id,
    title,
    label,
    lines,
    shape = "cards",
    tone = "default",
    landmarkLabel,
  }: SkeletonLayoutProps = $props();
</script>

<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
  <Block tag="div" class="w-full" role="status" aria-label={label} data-shape={shape} data-slot="skeleton">
    {#if ((shape as string) === "cards")}
      <Grid cols="1-3" class="gap-4">
        {#each lines as l (l.id)}
          <Stack gap="4" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
            <Skeleton class="aspect-video w-full" />
            <Skeleton class="h-4 w-2/3" />
            <Skeleton class="h-4 w-full" />
          </Stack>
        {/each}
      </Grid>
    {:else if ((shape as string) === "list")}
      <Stack gap="4" align="stretch">
        {#each lines as l (l.id)}
          <Group gap="4" align="center" data-slot="item">
            <Skeleton class="size-10 shrink-0 rounded-full" />
            <Stack gap="2" class="flex-1">
              <Skeleton class="h-4 w-1/3" />
              <Skeleton class="h-4 w-full" />
            </Stack>
          </Group>
        {/each}
      </Stack>
    {:else}
      <Stack gap="4" align="stretch" class="mx-auto max-w-2xl">
        <Skeleton class="h-8 w-3/4" />
        {#each lines as l (l.id)}
          <Stack gap="2" data-slot="item">
            <Skeleton class="h-4 w-full" />
            <Skeleton class="h-4 w-5/6" />
          </Stack>
        {/each}
      </Stack>
    {/if}
  </Block>
</SectionFrame>
blocks/skeleton-layout.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 Line = {
  id: 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 skeleton-layout
blocks/skeleton-layout.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 loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or
 * an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content
 * is loading. The shimmer itself belongs to the Skeleton part.
 */
import { type ReactNode } from "react";
import { Block, Grid, Group, Skeleton, Stack } from "../compose";
import { SectionFrame } from "../components/section-frame";
import type { Line } from "./skeleton-layout.types";

export type SkeletonLayoutProps = {
  id: string;
  title: string;
  label: string;
  lines: Line[];
  shape?: "cards" | "list" | "article";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function SkeletonLayout({
  id,
  title,
  label,
  lines,
  shape = "cards",
  tone = "default",
  landmarkLabel,
}: SkeletonLayoutProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
      <Block tag="div" className="w-full" role="status" aria-label={label} data-shape={shape} data-slot="skeleton">
        {((shape as string) === "cards") ? (
          <Grid cols="1-3" className="gap-4">
            {(lines ?? []).map((l) => (
              <Stack key={l.id} gap="4" className="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
                <Skeleton className="aspect-video w-full" />
                <Skeleton className="h-4 w-2/3" />
                <Skeleton className="h-4 w-full" />
              </Stack>
            ))}
          </Grid>
        ) : ((shape as string) === "list") ? (
          <Stack gap="4" align="stretch">
            {(lines ?? []).map((l) => (
              <Group key={l.id} gap="4" align="center" data-slot="item">
                <Skeleton className="size-10 shrink-0 rounded-full" />
                <Stack gap="2" className="flex-1">
                  <Skeleton className="h-4 w-1/3" />
                  <Skeleton className="h-4 w-full" />
                </Stack>
              </Group>
            ))}
          </Stack>
        ) : (
          <Stack gap="4" align="stretch" className="mx-auto max-w-2xl">
            <Skeleton className="h-8 w-3/4" />
            {(lines ?? []).map((l) => (
              <Stack key={l.id} gap="2" data-slot="item">
                <Skeleton className="h-4 w-full" />
                <Skeleton className="h-4 w-5/6" />
              </Stack>
            ))}
          </Stack>
        )}
      </Block>
    </SectionFrame>
  );
}
blocks/skeleton-layout.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 Line = {
  id: 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 skeleton-layout
blocks/skeleton-layout.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 Line = {
  id: string;
};
blocks/skeleton-layout.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 loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or
  an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content
  is loading. The shimmer itself belongs to the Skeleton part.
-->
<script lang="ts">
import type { Line } from "./skeleton-layout.types";

export type SkeletonLayoutProps = {
  id: string;
  title: string;
  label: string;
  lines: Line[];
  shape?: "cards" | "list" | "article";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Block from "../compose/Block.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import Skeleton from "../compose/Skeleton.vue";
import Stack from "../compose/Stack.vue";
import SectionFrame from "../components/section-frame.vue";

const {
  id,
  title,
  label,
  lines,
  shape = "cards",
  tone = "default",
  landmarkLabel,
} = defineProps<SkeletonLayoutProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :tone="tone" :landmarkLabel="landmarkLabel">
    <Block tag="div" class="w-full" role="status" :aria-label="label" :data-shape="shape" data-slot="skeleton">
      <Grid v-if="((shape as string) === 'cards')" cols="1-3" class="gap-4">
        <Stack
          v-for="l in lines"
          :key="l.id"
          gap="4"
          class="rounded bg-card inset-ring inset-ring-border p-4"
          data-slot="item"
        >
          <Skeleton class="aspect-video w-full" />
          <Skeleton class="h-4 w-2/3" />
          <Skeleton class="h-4 w-full" />
        </Stack>
      </Grid>
      <Stack v-else-if="((shape as string) === 'list')" gap="4" align="stretch">
        <Group v-for="l in lines" :key="l.id" gap="4" align="center" data-slot="item">
          <Skeleton class="size-10 shrink-0 rounded-full" />
          <Stack gap="2" class="flex-1">
            <Skeleton class="h-4 w-1/3" />
            <Skeleton class="h-4 w-full" />
          </Stack>
        </Group>
      </Stack>
      <Stack v-else gap="4" align="stretch" class="mx-auto max-w-2xl">
        <Skeleton class="h-8 w-3/4" />
        <Stack v-for="l in lines" :key="l.id" gap="2" data-slot="item">
          <Skeleton class="h-4 w-full" />
          <Skeleton class="h-4 w-5/6" />
        </Stack>
      </Stack>
    </Block>
  </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 skeleton-layout
blocks/skeleton-layout.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 loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or
 * an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content
 * is loading. The shimmer itself belongs to the Skeleton part.
 */
import { For, type JSX } from "solid-js";
import { Block, Grid, Group, Skeleton, Stack } from "../compose";
import { SectionFrame } from "../components/section-frame";
import type { Line } from "./skeleton-layout.types";

export type SkeletonLayoutProps = {
  id: string;
  title: string;
  label: string;
  lines: Line[];
  shape?: "cards" | "list" | "article";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function SkeletonLayout({
  id,
  title,
  label,
  lines,
  shape = "cards",
  tone = "default",
  landmarkLabel,
}: SkeletonLayoutProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
      <Block tag="div" class="w-full" role="status" aria-label={label} data-shape={shape} data-slot="skeleton">
        {((shape as string) === "cards") ? (
          <Grid cols="1-3" class="gap-4">
            <For each={lines ?? []}>{(l) => (
              <Stack gap="4" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
                <Skeleton class="aspect-video w-full" />
                <Skeleton class="h-4 w-2/3" />
                <Skeleton class="h-4 w-full" />
              </Stack>
            )}</For>
          </Grid>
        ) : ((shape as string) === "list") ? (
          <Stack gap="4" align="stretch">
            <For each={lines ?? []}>{(l) => (
              <Group gap="4" align="center" data-slot="item">
                <Skeleton class="size-10 shrink-0 rounded-full" />
                <Stack gap="2" class="flex-1">
                  <Skeleton class="h-4 w-1/3" />
                  <Skeleton class="h-4 w-full" />
                </Stack>
              </Group>
            )}</For>
          </Stack>
        ) : (
          <Stack gap="4" align="stretch" class="mx-auto max-w-2xl">
            <Skeleton class="h-8 w-3/4" />
            <For each={lines ?? []}>{(l) => (
              <Stack gap="2" data-slot="item">
                <Skeleton class="h-4 w-full" />
                <Skeleton class="h-4 w-5/6" />
              </Stack>
            )}</For>
          </Stack>
        )}
      </Block>
    </SectionFrame>
  );
}
blocks/skeleton-layout.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 Line = {
  id: 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 skeleton-layout
blocks/skeleton-layout.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/skeleton-layout.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"
)

// SkeletonLayoutProps are the props of SkeletonLayout; the values are the JSON shapes of the TypeScript props.
type SkeletonLayoutProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Label any `json:"label"`
	Lines any `json:"lines"`
	Shape any `json:"shape"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// The loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content is loading. The shimmer itself belongs to the Skeleton part.
templ SkeletonLayout(p SkeletonLayoutProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLabel := p.Label }}
	{{ vLines := p.Lines }}
	{{ vShape := uiutils.Def(p.Shape, "cards") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
		@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "div", Class: "w-full", Attrs: uiutils.Attrs("role", "status", "aria-label", vLabel, "data-shape", vShape, "data-slot", "skeleton")}}) {
			if uiutils.Eq(vShape, "cards") {
				@compose.Grid(compose.GridProps{Cols: "1-3", BoxProps: box.BoxProps{Class: "gap-4"}}) {
					for range uiutils.L(vLines) {
						@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "aspect-video w-full"}})
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-2/3"}})
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-full"}})
						}
					}
				}
			} else if uiutils.Eq(vShape, "list") {
				@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{}}) {
					for range uiutils.L(vLines) {
						@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "item")}}) {
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "size-10 shrink-0 rounded-full"}})
							@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "flex-1"}}) {
								@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-1/3"}})
								@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-full"}})
							}
						}
					}
				}
			} else {
				@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: "mx-auto max-w-2xl"}}) {
					@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-8 w-3/4"}})
					for range uiutils.L(vLines) {
						@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "item")}}) {
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-full"}})
							@compose.Skeleton(compose.SkeletonProps{BoxProps: box.BoxProps{Class: "h-4 w-5/6"}})
						}
					}
				}
			}
		}
	}
}

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 skeleton-layout
blocks/skeleton-layout.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/skeleton-layout.json
    The loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content is loading. The shimmer itself belongs to the Skeleton part.
    Props (p): id, title, label, lines, shape, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_label = (p.label ?? null) -%}
{%- set v_lines = (p.lines ?? null) -%}
{%- set v_shape = (p.shape ?? 'cards') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- if og_t(og_eq(v_shape, 'cards')) %}
      {%- set c_2 -%}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_1 -%}
            {{ include('compose/Skeleton.html.twig', {'class': 'aspect-video w-full'}, with_context = false) }}
            {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-2/3'}, with_context = false) }}
            {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-full'}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '4', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_1}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Grid.html.twig', {'cols': '1-3', 'class': 'gap-4', 'children': c_2}, with_context = false) }}
    {%- elseif og_t(og_eq(v_shape, 'list')) %}
      {%- set c_5 -%}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_4 -%}
            {{ include('compose/Skeleton.html.twig', {'class': 'size-10 shrink-0 rounded-full'}, with_context = false) }}
            {%- set c_3 -%}
              {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-1/3'}, with_context = false) }}
              {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-full'}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'flex-1', 'children': c_3}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_4}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'children': c_5}, with_context = false) }}
    {%- else %}
      {%- set c_7 -%}
        {{ include('compose/Skeleton.html.twig', {'class': 'h-8 w-3/4'}, with_context = false) }}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_6 -%}
            {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-full'}, with_context = false) }}
            {{ include('compose/Skeleton.html.twig', {'class': 'h-4 w-5/6'}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '2', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_6}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': 'mx-auto max-w-2xl', 'children': c_7}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/Block.html.twig', {'tag': 'div', 'class': 'w-full', 'attrs': og_attrs(['role', 'status', 'aria-label', v_label, 'data-shape', v_shape, 'data-slot', 'skeleton']), 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(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 skeleton-layout
blocks/skeleton-layout.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/skeleton-layout.json
    The loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content is loading. The shimmer itself belongs to the Skeleton part.
    Props (p): id, title, label, lines, shape, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_label = ($p['label'] ?? null)}
{var $v_lines = ($p['lines'] ?? null)}
{var $v_shape = ($p['shape'] ?? 'cards')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_9}
  {capture $c_8}
    {if og_t(og_eq($v_shape, 'cards'))}
      {capture $c_2}
        {foreach og_l($v_lines) as $v_l}
          {capture $c_1}
            {=og_include('compose/Skeleton.latte', ['class' => 'aspect-video w-full'])|noescape}
            {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-2/3'])|noescape}
            {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-full'])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '4', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_1])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Grid.latte', ['cols' => '1-3', 'class' => 'gap-4', 'children' => (string) $c_2])|noescape}
    {elseif og_t(og_eq($v_shape, 'list'))}
      {capture $c_5}
        {foreach og_l($v_lines) as $v_l}
          {capture $c_4}
            {=og_include('compose/Skeleton.latte', ['class' => 'size-10 shrink-0 rounded-full'])|noescape}
            {capture $c_3}
              {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-1/3'])|noescape}
              {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-full'])|noescape}
            {/capture}
            {=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'flex-1', 'children' => (string) $c_3])|noescape}
          {/capture}
          {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_4])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'children' => (string) $c_5])|noescape}
    {else}
      {capture $c_7}
        {=og_include('compose/Skeleton.latte', ['class' => 'h-8 w-3/4'])|noescape}
        {foreach og_l($v_lines) as $v_l}
          {capture $c_6}
            {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-full'])|noescape}
            {=og_include('compose/Skeleton.latte', ['class' => 'h-4 w-5/6'])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '2', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_6])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => 'mx-auto max-w-2xl', 'children' => (string) $c_7])|noescape}
    {/if}
  {/capture}
  {=og_include('compose/Block.latte', ['tag' => 'div', 'class' => 'w-full', 'attrs' => og_attrs(['role', 'status', 'aria-label', $v_label, 'data-shape', $v_shape, 'data-slot', 'skeleton']), 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($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 skeleton-layout
blocks/skeleton-layout.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/skeleton-layout.json
    The loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content is loading. The shimmer itself belongs to the Skeleton part.
    Props (p): id, title, label, lines, shape, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_label = og_def(p['label'], none) -%}
{%- set v_lines = og_def(p['lines'], none) -%}
{%- set v_shape = og_def(p['shape'], 'cards') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- if og_t(og_eq(v_shape, 'cards')) %}
      {%- set c_2 -%}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_1 -%}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'aspect-video w-full'}}) }}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-2/3'}}) }}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-full'}}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_1}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-3', 'Class': 'gap-4'}, 'children': c_2}) }}
    {%- elif og_t(og_eq(v_shape, 'list')) %}
      {%- set c_5 -%}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_4 -%}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'size-10 shrink-0 rounded-full'}}) }}
            {%- set c_3 -%}
              {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-1/3'}}) }}
              {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-full'}}) }}
            {%- endset -%}
            {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'flex-1'}, 'children': c_3}) }}
          {%- endset -%}
          {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_4}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch'}, 'children': c_5}) }}
    {%- else %}
      {%- set c_7 -%}
        {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-8 w-3/4'}}) }}
        {%- for v_l in og_l(v_lines) %}
          {%- set c_6 -%}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-full'}}) }}
            {{ og_include('compose/skeleton.html.j2', {'p': {'Class': 'h-4 w-5/6'}}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_6}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': 'mx-auto max-w-2xl'}, 'children': c_7}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/block.html.j2', {'p': {'Tag': 'div', 'Class': 'w-full', 'Attrs': og_attrs(['role', 'status', 'aria-label', v_label, 'data-shape', v_shape, 'data-slot', 'skeleton'])}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(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.

The loading state of a page: grey blocks in the shape of the content that is coming (cards, a list of rows or an article). Axes: shape (cards, list, article), tone. The label tells assistive technology that the content is loading. The shimmer itself belongs to the Skeleton part.

Props of SkeletonLayout
PropTypeDefault Description
id (required)string-
title (required)string-
label (required)string-e.g. `Loading`
lines (required)Line[]-how many placeholders to draw
shape "cards" | "list" | "article""cards"
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