Feature Accordion
Features as a list of disclosures, the first one open, with an optional picture.
Install
npx ui8kit add feature-accordionPulls in: compose, disclosure, empty-state, feature-grid, inline, kit-box, kit-disclosure, kit-text, lucide-icon, media-frame, section-frame, stack, summary, text, utils
Preview
Questions about the features
Fast by default
Pages render from static data and ship little script.
Clear structure
One heading per page, landmarks and a skip link come built in.
Safe forms
Inputs carry labels and errors are announced to assistive tools.
Ready for any language
Every text lives in a dictionary, so a new language is one more file.
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 feature-accordion<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the
first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Feature } from "./feature-grid.types";
export type FeatureAccordionProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
expand?: "first" | "none";
media?: "none" | "image";
multiple?: boolean;
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Disclosure from "../compose/Disclosure.svelte";
import Inline from "../compose/Inline.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Summary from "../compose/Summary.svelte";
import Text from "../compose/Text.svelte";
import EmptyState from "../components/empty-state.svelte";
import MediaFrame from "../components/media-frame.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { tpl } from "../utils";
let {
id,
title,
features,
empty = "",
expand = "first",
media = "none",
multiple = false,
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureAccordionProps = $props();
</script>
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
layout={(((media as string) === "image") ? "split" : "stack")}
media={{ show: ((media as string) === "image") }}
landmarkLabel={landmarkLabel}
>
{#if ((features?.length ?? 0) === 0)}
<EmptyState icon="layout-grid" title={empty} />
{:else}
<Stack gap="0" align="stretch" data-slot="items">
{#each features as f, i (f.id)}
<Disclosure
variant="item"
name={(multiple ? undefined : tpl("{0}-accordion", (id ?? "accordion")))}
open={(((expand as string) === "first") && (i === 0))}
data-slot="item"
>
<Summary variant="item">
<Inline class="flex min-w-0 items-center justify-start gap-4">
<LucideIcon name={f.icon} size={20} />
<Inline class="text-base font-semibold">
{f.title}
</Inline>
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{f.text}
</Text>
</Disclosure>
{/each}
</Stack>
{/if}
{#snippet aside()}
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
{/snippet}
</SectionFrame>
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 feature-accordion// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the
* first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
*/
import { type ReactNode } from "react";
import { Disclosure, Inline, Stack, Summary, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Feature } from "./feature-grid.types";
export type FeatureAccordionProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
expand?: "first" | "none";
media?: "none" | "image";
multiple?: boolean;
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function FeatureAccordion({
id,
title,
features,
empty = "",
expand = "first",
media = "none",
multiple = false,
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureAccordionProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
layout={(((media as string) === "image") ? "split" : "stack")}
media={{ show: ((media as string) === "image") }}
landmarkLabel={landmarkLabel}
aside={(
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
)}
>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Stack gap="0" align="stretch" data-slot="items">
{(features ?? []).map((f, i) => (
<Disclosure key={f.id}
variant="item"
name={(multiple ? undefined : tpl("{0}-accordion", (id ?? "accordion")))}
open={(((expand as string) === "first") && (i === 0))}
data-slot="item"
>
<Summary variant="item">
<Inline className="flex min-w-0 items-center justify-start gap-4">
<LucideIcon name={f.icon} size={20} />
<Inline className="text-base font-semibold">
{f.title}
</Inline>
</Inline>
</Summary>
<Text size="sm" className="pb-4 text-muted-foreground">
{f.text}
</Text>
</Disclosure>
))}
</Stack>
)}
</SectionFrame>
);
}
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 feature-accordion<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the
first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
-->
<script lang="ts">
import type { Feature } from "./feature-grid.types";
export type FeatureAccordionProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
expand?: "first" | "none";
media?: "none" | "image";
multiple?: boolean;
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Disclosure from "../compose/Disclosure.vue";
import Inline from "../compose/Inline.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Summary from "../compose/Summary.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { tpl } from "../utils";
const {
id,
title,
features,
empty = "",
expand = "first",
media = "none",
multiple = false,
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
} = defineProps<FeatureAccordionProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:tone="tone"
:density="density"
:layout="(((media as string) === 'image') ? 'split' : 'stack')"
:media="{ show: ((media as string) === 'image') }"
:landmarkLabel="landmarkLabel"
>
<EmptyState v-if="((features?.length ?? 0) === 0)" icon="layout-grid" :title="empty" />
<Stack v-else gap="0" align="stretch" data-slot="items">
<Disclosure v-for="(f, i) in features" :key="f.id"
variant="item"
:name="(multiple ? undefined : tpl('{0}-accordion', (id ?? 'accordion')))"
:open="(((expand as string) === 'first') && (i === 0))"
data-slot="item"
>
<Summary variant="item">
<Inline class="flex min-w-0 items-center justify-start gap-4">
<LucideIcon :name="f.icon" :size="20" />
<Inline class="text-base font-semibold">
{{ f.title }}
</Inline>
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{{ f.text }}
</Text>
</Disclosure>
</Stack>
<template #aside>
<MediaFrame :alt="(imageAlt ? imageAlt : title)" :src="image" ratio="4/3" />
</template>
</SectionFrame>
</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 feature-accordion// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the
* first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
*/
import { For, type JSX } from "solid-js";
import { Disclosure, Inline, Stack, Summary, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Feature } from "./feature-grid.types";
export type FeatureAccordionProps = {
id: string;
title: string;
features: Feature[];
empty?: string;
expand?: "first" | "none";
media?: "none" | "image";
multiple?: boolean;
tone?: "default" | "muted";
density?: "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function FeatureAccordion({
id,
title,
features,
empty = "",
expand = "first",
media = "none",
multiple = false,
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: FeatureAccordionProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
layout={(((media as string) === "image") ? "split" : "stack")}
media={{ show: ((media as string) === "image") }}
landmarkLabel={landmarkLabel}
aside={(
<MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} ratio="4/3" />
)}
>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Stack gap="0" align="stretch" data-slot="items">
<For each={features ?? []}>{(f, iOf) => { const i = iOf(); return (
<Disclosure
variant="item"
name={(multiple ? undefined : tpl("{0}-accordion", (id ?? "accordion")))}
open={(((expand as string) === "first") && (i === 0))}
data-slot="item"
>
<Summary variant="item">
<Inline class="flex min-w-0 items-center justify-start gap-4">
<LucideIcon name={f.icon} size={20} />
<Inline class="text-base font-semibold">
{f.title}
</Inline>
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{f.text}
</Text>
</Disclosure>
); }}</For>
</Stack>
)}
</SectionFrame>
);
}
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 feature-accordion// 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/feature-accordion.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/disclosure"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// FeatureAccordionProps are the props of FeatureAccordion; the values are the JSON shapes of the TypeScript props.
type FeatureAccordionProps struct {
Id any `json:"id"`
Title any `json:"title"`
Features any `json:"features"`
Empty any `json:"empty"`
Expand any `json:"expand"`
Media any `json:"media"`
Multiple any `json:"multiple"`
Tone any `json:"tone"`
Density any `json:"density"`
Image any `json:"image"`
ImageAlt any `json:"imageAlt"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
templ FeatureAccordion(p FeatureAccordionProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vFeatures := p.Features }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vExpand := uiutils.Def(p.Expand, "first") }}
{{ vMedia := uiutils.Def(p.Media, "none") }}
{{ vMultiple := uiutils.Def(p.Multiple, false) }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vImage := p.Image }}
{{ vImageAlt := p.ImageAlt }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, Layout: uiutils.Cond(uiutils.T(uiutils.Eq(vMedia, "image")), "split", "stack"), Media: map[string]any{"show": uiutils.Eq(vMedia, "image")}, LandmarkLabel: vLandmarkLabel, Aside: featureAccordionFill1(p, vTitle, vImage, vImageAlt)}) {
if uiutils.Eq(uiutils.Len(vFeatures), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "layout-grid", Title: vEmpty})
} else {
@compose.Stack(compose.StackProps{Gap: "0", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "items")}}) {
for vI, vF := range uiutils.L(vFeatures) {
@compose.Disclosure(compose.DisclosureProps{Variant: "item", DisclosureProps: disclosure.DisclosureProps{Name: uiutils.S(uiutils.Cond(uiutils.T(vMultiple), nil, uiutils.Tpl("{0}-accordion", uiutils.Coalesce(vId, "accordion")))), Open: uiutils.T(uiutils.And(uiutils.Eq(vExpand, "first"), uiutils.Eq(float64(vI), float64(0)))), Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Summary(compose.SummaryProps{Variant: "item", SummaryProps: disclosure.SummaryProps{}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex min-w-0 items-center justify-start gap-4"}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vF, "icon")), Size: 20})
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-base font-semibold"}}) {
{ uiutils.Text(uiutils.Get(vF, "title")) }
}
}
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "pb-4 text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vF, "text")) }
}
}
}
}
}
}
}
templ featureAccordionFill1(p FeatureAccordionProps, vTitle any, vImage any, vImageAlt any) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage, Ratio: "4/3"})
}
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 feature-accordion{#- 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/feature-accordion.json
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
Props (p): id, title, features, empty, expand, media, multiple, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_features = (p.features ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_expand = (p.expand ?? 'first') -%}
{%- set v_media = (p.media ?? 'none') -%}
{%- set v_multiple = (p.multiple ?? false) -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set f_7 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image, 'ratio': '4/3'}}, with_context = false) }}
{%- endset -%}
{%- set c_8 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layout-grid', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_6 -%}
{%- for v_f in og_l(v_features) %}
{%- set v_i = loop.index0 -%}
{%- set c_5 -%}
{%- set c_3 -%}
{%- set c_2 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_f, ['icon'])), 'size': 20}, with_context = false) }}
{%- set c_1 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-base font-semibold', 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex min-w-0 items-center justify-start gap-4', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Summary.html.twig', {'variant': 'item', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'pb-4 text-muted-foreground', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Disclosure.html.twig', {'variant': 'item', 'name': og_s((og_t(v_multiple) ? null : og_tpl('{0}-accordion', [og_coalesce([v_id, 'accordion'])]))), 'open': og_t(og_and([og_eq(v_expand, 'first'), og_eq(v_i, 0)])), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_5}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'layout': (og_t(og_eq(v_media, 'image')) ? 'split' : 'stack'), 'media': {'show': og_eq(v_media, 'image')}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_7)}, 'children': og_markup(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 feature-accordion{* 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/feature-accordion.json
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
Props (p): id, title, features, empty, expand, media, multiple, tone, density, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_features = ($p['features'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_expand = ($p['expand'] ?? 'first')}
{var $v_media = ($p['media'] ?? 'none')}
{var $v_multiple = ($p['multiple'] ?? false)}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $f_7}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image, 'ratio' => '4/3']])|noescape}
{/capture}
{capture $c_8}
{if og_t(og_eq(og_len($v_features), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layout-grid', 'title' => $v_empty]])|noescape}
{else}
{capture $c_6}
{foreach og_l($v_features) as $v_f}
{var $v_i = $iterator->counter0}
{capture $c_5}
{capture $c_3}
{capture $c_2}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_f, ['icon'])), 'size' => 20])|noescape}
{capture $c_1}
{=og_text(og_get($v_f, ['title']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-base font-semibold', 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex min-w-0 items-center justify-start gap-4', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Summary.latte', ['variant' => 'item', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_get($v_f, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'pb-4 text-muted-foreground', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Disclosure.latte', ['variant' => 'item', 'name' => og_s((og_t($v_multiple) ? null : og_tpl('{0}-accordion', [og_coalesce([$v_id, 'accordion'])]))), 'open' => og_t(og_and([og_eq($v_expand, 'first'), og_eq($v_i, 0)])), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_5])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_6])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'layout' => (og_t(og_eq($v_media, 'image')) ? 'split' : 'stack'), 'media' => ['show' => og_eq($v_media, 'image')], 'landmarkLabel' => $v_landmarkLabel, 'aside' => og_markup($f_7)], 'children' => og_markup($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 feature-accordion{#- 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/feature-accordion.json
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
Props (p): id, title, features, empty, expand, media, multiple, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_expand = og_def(p['expand'], 'first') -%}
{%- set v_media = og_def(p['media'], 'none') -%}
{%- set v_multiple = og_def(p['multiple'], false) -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], '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 f_7 -%}
{{ 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'}}) }}
{%- endset -%}
{%- set c_8 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layout-grid', 'title': v_empty}}) }}
{%- else %}
{%- set c_6 -%}
{%- for v_f in og_l(v_features) %}
{%- set v_i = loop.index0 -%}
{%- set c_5 -%}
{%- set c_3 -%}
{%- set c_2 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_f, ['icon'])), 'Size': 20}}) }}
{%- set c_1 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-base font-semibold'}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex min-w-0 items-center justify-start gap-4'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/summary.html.j2', {'p': {'Variant': 'item'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'pb-4 text-muted-foreground'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/disclosure.html.j2', {'p': {'Variant': 'item', 'Name': og_s((none if og_t(v_multiple) else og_tpl('{0}-accordion', [og_coalesce([v_id, 'accordion'])]))), 'Open': og_t(og_and([og_eq(v_expand, 'first'), og_eq(v_i, 0)])), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_5}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_6}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'layout': ('split' if og_t(og_eq(v_media, 'image')) else 'stack'), 'media': {'show': og_eq(v_media, 'image')}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_7)}, 'children': og_markup(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.
Features as a list of disclosures: icon and title in the summary, the text when open. Axes: expand (first: the first one is open, none: all closed), media (none, image: a picture beside the list), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| features (required) | Feature[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| expand | "first" | "none" | "first" | |
| media | "none" | "image" | "none" | |
| multiple | boolean | false | true: several can be open at once; false: opening one closes the others (native details name) |
| tone | "default" | "muted" | "default" | |
| density | "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 |