Faq Disclosures
Faq Disclosures component
Install
npx ui8kit add faq-disclosuresPulls in: compose, disclosure, faq-split, kit-box, kit-disclosure, kit-text, stack, summary, text, utils
Preview
How do I start a new site?
Pick a template, change the texts in one dictionary and publish. Most sites are live in an hour.
Can I use my own domain?
Yes. Point your domain at the site and we issue the certificate for you.
When am I billed?
On the same day each month. You can switch to yearly billing and save two months.
Do you give refunds?
Within 30 days of a payment, no questions asked.
How do I invite my team?
Open the settings, add their addresses and choose what each person can edit.
Can I take my content with me?
Every plan exports all pages and texts as plain files at any time.
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 faq-disclosures<!-- 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 questions of FaqSplit as native disclosures, one open at a time. -->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Question, FaqSplitLabels } from "../blocks/faq-split.types";
export type FaqDisclosuresProps = {
items: Question[];
name: string;
};
</script>
<script lang="ts">
import Disclosure from "../compose/Disclosure.svelte";
import Stack from "../compose/Stack.svelte";
import Summary from "../compose/Summary.svelte";
import Text from "../compose/Text.svelte";
let { items, name }: FaqDisclosuresProps = $props();
</script>
<Stack gap="0" align="stretch" data-slot="faq">
{#each items as q (q.id)}
<Disclosure variant="item" name={name} data-slot="faq-item">
<Summary variant="item">
{q.question}
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{q.answer}
</Text>
</Disclosure>
{/each}
</Stack>
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 faq-disclosures// 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 questions of FaqSplit as native disclosures, one open at a time. */
import { type ReactNode } from "react";
import { Disclosure, Stack, Summary, Text } from "../compose";
import type { Question, FaqSplitLabels } from "../blocks/faq-split.types";
export type FaqDisclosuresProps = {
items: Question[];
name: string;
};
export function FaqDisclosures({ items, name }: FaqDisclosuresProps) {
return (
<Stack gap="0" align="stretch" data-slot="faq">
{(items ?? []).map((q) => (
<Disclosure key={q.id} variant="item" name={name} data-slot="faq-item">
<Summary variant="item">
{q.question}
</Summary>
<Text size="sm" className="pb-4 text-muted-foreground">
{q.answer}
</Text>
</Disclosure>
))}
</Stack>
);
}
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 faq-disclosures<!-- 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 questions of FaqSplit as native disclosures, one open at a time. -->
<script lang="ts">
import type { Question, FaqSplitLabels } from "../blocks/faq-split.types";
export type FaqDisclosuresProps = {
items: Question[];
name: string;
};
</script>
<script setup lang="ts">
import Disclosure from "../compose/Disclosure.vue";
import Stack from "../compose/Stack.vue";
import Summary from "../compose/Summary.vue";
import Text from "../compose/Text.vue";
const { items, name } = defineProps<FaqDisclosuresProps>();
</script>
<template>
<Stack gap="0" align="stretch" data-slot="faq">
<Disclosure v-for="q in items" :key="q.id" variant="item" :name="name" data-slot="faq-item">
<Summary variant="item">
{{ q.question }}
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{{ q.answer }}
</Text>
</Disclosure>
</Stack>
</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 faq-disclosures// 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 questions of FaqSplit as native disclosures, one open at a time. */
import { For, type JSX } from "solid-js";
import { Disclosure, Stack, Summary, Text } from "../compose";
import type { Question, FaqSplitLabels } from "../blocks/faq-split.types";
export type FaqDisclosuresProps = {
items: Question[];
name: string;
};
export function FaqDisclosures({ items, name }: FaqDisclosuresProps) {
return (
<Stack gap="0" align="stretch" data-slot="faq">
<For each={items ?? []}>{(q) => (
<Disclosure variant="item" name={name} data-slot="faq-item">
<Summary variant="item">
{q.question}
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{q.answer}
</Text>
</Disclosure>
)}</For>
</Stack>
);
}
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 faq-disclosures// 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/faq-disclosures.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/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// FaqDisclosuresProps are the props of FaqDisclosures; the values are the JSON shapes of the TypeScript props.
type FaqDisclosuresProps struct {
Items any `json:"items"`
Name any `json:"name"`
}
// The questions of FaqSplit as native disclosures, one open at a time.
templ FaqDisclosures(p FaqDisclosuresProps) {
{{ vItems := p.Items }}
{{ vName := p.Name }}
@compose.Stack(compose.StackProps{Gap: "0", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "faq")}}) {
for _, vQ := range uiutils.L(vItems) {
@compose.Disclosure(compose.DisclosureProps{Variant: "item", DisclosureProps: disclosure.DisclosureProps{Name: uiutils.S(vName), Attrs: uiutils.Attrs("data-slot", "faq-item")}}) {
@compose.Summary(compose.SummaryProps{Variant: "item", SummaryProps: disclosure.SummaryProps{}}) {
{ uiutils.Text(uiutils.Get(vQ, "question")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "pb-4 text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vQ, "answer")) }
}
}
}
}
}
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 faq-disclosures{#- 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/faq-disclosures.json
The questions of FaqSplit as native disclosures, one open at a time.
Props (p): items, name. -#}
{%- set v_items = (p.items ?? null) -%}
{%- set v_name = (p.name ?? null) -%}
{%- set c_4 -%}
{%- for v_q in og_l(v_items) %}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_q, ['question'])) }}
{%- endset -%}
{{ include('compose/Summary.html.twig', {'variant': 'item', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_q, ['answer'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'pb-4 text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Disclosure.html.twig', {'variant': 'item', 'name': og_s(v_name), 'attrs': og_attrs(['data-slot', 'faq-item']), 'children': c_3}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'faq']), 'children': c_4}, 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 faq-disclosures{* 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/faq-disclosures.json
The questions of FaqSplit as native disclosures, one open at a time.
Props (p): items, name. *}
{var $v_items = ($p['items'] ?? null)}
{var $v_name = ($p['name'] ?? null)}
{capture $c_4}
{foreach og_l($v_items) as $v_q}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_q, ['question']))}
{/capture}
{=og_include('compose/Summary.latte', ['variant' => 'item', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_q, ['answer']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'pb-4 text-muted-foreground', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Disclosure.latte', ['variant' => 'item', 'name' => og_s($v_name), 'attrs' => og_attrs(['data-slot', 'faq-item']), 'children' => (string) $c_3])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'faq']), 'children' => (string) $c_4])|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 faq-disclosures{#- 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/faq-disclosures.json
The questions of FaqSplit as native disclosures, one open at a time.
Props (p): items, name. -#}
{%- set v_items = og_def(p['items'], none) -%}
{%- set v_name = og_def(p['name'], none) -%}
{%- set c_4 -%}
{%- for v_q in og_l(v_items) %}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_q, ['question'])) }}
{%- endset -%}
{{ og_include('compose/summary.html.j2', {'p': {'Variant': 'item'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_q, ['answer'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'pb-4 text-muted-foreground'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/disclosure.html.j2', {'p': {'Variant': 'item', 'Name': og_s(v_name), 'Attrs': og_attrs(['data-slot', 'faq-item'])}, 'children': c_3}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'faq'])}, 'children': c_4}) }}
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 questions of FaqSplit as native disclosures, one open at a time.
| Prop | Type | Default | Description |
|---|---|---|---|
| items (required) | Question[] | - | |
| name (required) | string | - | the group name of the disclosures (one open at a time) |