Contact Form
A message form, alone or beside the ways to reach us.
Install
npx ui8kit add contact-formPulls in: button, checkbox, compose, feature-grid, field, form, grid, group, input, kit-box, kit-button, kit-checkbox, kit-form, kit-input, kit-label, kit-text, kit-textarea, label, lucide-icon, section-frame, stack, text, textarea, utils
Preview
Contact us
Tell us what you need and a person will answer within one working day.
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 contact-form<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach
us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone
(default, muted).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { ContactLabels } from "./contact-form.types";
import type { Feature } from "./feature-grid.types";
export type ContactFormProps = {
id: string;
title: string;
text: string;
labels: ContactLabels;
details: Feature[];
layout?: "single" | "split";
fields?: "short" | "full";
terms?: "show" | "hide";
level?: 1 | 2;
page?: "section" | "full";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Button from "../compose/Button.svelte";
import Checkbox from "../compose/Checkbox.svelte";
import Form from "../compose/Form.svelte";
import Grid from "../compose/Grid.svelte";
import Group from "../compose/Group.svelte";
import Input from "../compose/Input.svelte";
import Label from "../compose/Label.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Textarea from "../compose/Textarea.svelte";
import Field from "../components/field.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { cn, tpl } from "../utils";
let {
id,
title,
text,
labels,
details,
layout = "single",
fields = "full",
terms = "hide",
level = 2,
page = "section",
tone = "default",
landmarkLabel,
}: ContactFormProps = $props();
</script>
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
tone={tone}
density={(((page as string) === "full") ? "roomy" : "default")}
align={(((page as string) === "full") ? "center" : "start")}
measure={(((layout as string) === "single") ? "xl" : "default")}
landmarkLabel={landmarkLabel}
>
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
<Form method="dialog" class="w-full gap-4" data-slot="contact-form">
{#if ((fields as string) === "full")}
<Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
<Input type="text" name="name" autocomplete="name" id={tpl("{0}-name", id)} data-slot="field" />
</Field>
{/if}
<Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
{#if ((fields as string) === "full")}
<Field label={labels.subject} htmlFor={tpl("{0}-subject", id)}>
<Input type="text" name="subject" id={tpl("{0}-subject", id)} data-slot="field" />
</Field>
{/if}
<Field label={labels.message} htmlFor={tpl("{0}-message", id)}>
<Textarea rows={4} name="message" id={tpl("{0}-message", id)} data-slot="field" />
</Field>
{#if ((terms as string) === "show")}
<Group gap="2" align="center" class={cn("w-fit", "")}>
<Checkbox name="consent" id={tpl("{0}-consent", id)} />
<Label for={tpl("{0}-consent", id)} class="text-sm">
{labels.consent}
</Label>
</Group>
{/if}
<Button variant="default" size="default" type="submit" class="w-fit">
{labels.submit}
</Button>
</Form>
{#if (((layout as string) === "split") && ((details?.length ?? 0) > 0))}
<Stack gap="4" data-slot="details">
{#each details as d (d.id)}
<Group gap="4" align="start" data-slot="detail">
<LucideIcon name={d.icon} size={20} />
<Stack gap="0">
<Text size="base" weight="semibold">
{d.title}
</Text>
<Text size="sm" class="text-muted-foreground">
{d.text}
</Text>
</Stack>
</Group>
{/each}
</Stack>
{/if}
</Grid>
</SectionFrame>
// 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 ContactLabels = {
name: string;
email: string;
subject: string;
message: string;
consent: string;
submit: string;
};
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 contact-form// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach
* us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone
* (default, muted).
*/
import { type ReactNode } from "react";
import { Button, Checkbox, Form, Grid, Group, Input, Label, Stack, Text, Textarea } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { Field } from "../components/field";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { ContactLabels } from "./contact-form.types";
import type { Feature } from "./feature-grid.types";
export type ContactFormProps = {
id: string;
title: string;
text: string;
labels: ContactLabels;
details: Feature[];
layout?: "single" | "split";
fields?: "short" | "full";
terms?: "show" | "hide";
level?: 1 | 2;
page?: "section" | "full";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ContactForm({
id,
title,
text,
labels,
details,
layout = "single",
fields = "full",
terms = "hide",
level = 2,
page = "section",
tone = "default",
landmarkLabel,
}: ContactFormProps) {
return (
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
tone={tone}
density={(((page as string) === "full") ? "roomy" : "default")}
align={(((page as string) === "full") ? "center" : "start")}
measure={(((layout as string) === "single") ? "xl" : "default")}
landmarkLabel={landmarkLabel}
>
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} className="items-start gap-8">
<Form method="dialog" className="w-full gap-4" data-slot="contact-form">
{((fields as string) === "full") ? (
<Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
<Input type="text" name="name" autoComplete="name" id={tpl("{0}-name", id)} data-slot="field" />
</Field>
) : null}
<Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autoComplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
{((fields as string) === "full") ? (
<Field label={labels.subject} htmlFor={tpl("{0}-subject", id)}>
<Input type="text" name="subject" id={tpl("{0}-subject", id)} data-slot="field" />
</Field>
) : null}
<Field label={labels.message} htmlFor={tpl("{0}-message", id)}>
<Textarea rows={4} name="message" id={tpl("{0}-message", id)} data-slot="field" />
</Field>
{((terms as string) === "show") ? (
<Group gap="2" align="center" className={cn("w-fit", "")}>
<Checkbox name="consent" id={tpl("{0}-consent", id)} />
<Label htmlFor={tpl("{0}-consent", id)} className="text-sm">
{labels.consent}
</Label>
</Group>
) : null}
<Button variant="default" size="default" type="submit" className="w-fit">
{labels.submit}
</Button>
</Form>
{(((layout as string) === "split") && ((details?.length ?? 0) > 0)) ? (
<Stack gap="4" data-slot="details">
{(details ?? []).map((d) => (
<Group key={d.id} gap="4" align="start" data-slot="detail">
<LucideIcon name={d.icon} size={20} />
<Stack gap="0">
<Text size="base" weight="semibold">
{d.title}
</Text>
<Text size="sm" className="text-muted-foreground">
{d.text}
</Text>
</Stack>
</Group>
))}
</Stack>
) : null}
</Grid>
</SectionFrame>
);
}
// 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 ContactLabels = {
name: string;
email: string;
subject: string;
message: string;
consent: string;
submit: string;
};
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 contact-form// 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 ContactLabels = {
name: string;
email: string;
subject: string;
message: string;
consent: string;
submit: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach
us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone
(default, muted).
-->
<script lang="ts">
import type { ContactLabels } from "./contact-form.types";
import type { Feature } from "./feature-grid.types";
export type ContactFormProps = {
id: string;
title: string;
text: string;
labels: ContactLabels;
details: Feature[];
layout?: "single" | "split";
fields?: "short" | "full";
terms?: "show" | "hide";
level?: 1 | 2;
page?: "section" | "full";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Button from "../compose/Button.vue";
import Checkbox from "../compose/Checkbox.vue";
import Form from "../compose/Form.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import Input from "../compose/Input.vue";
import Label from "../compose/Label.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Textarea from "../compose/Textarea.vue";
import Field from "../components/field.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, tpl } from "../utils";
const {
id,
title,
text,
labels,
details,
layout = "single",
fields = "full",
terms = "hide",
level = 2,
page = "section",
tone = "default",
landmarkLabel,
} = defineProps<ContactFormProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:lead="text"
:heading="{ level }"
:tone="tone"
:density="(((page as string) === 'full') ? 'roomy' : 'default')"
:align="(((page as string) === 'full') ? 'center' : 'start')"
:measure="(((layout as string) === 'single') ? 'xl' : 'default')"
:landmarkLabel="landmarkLabel"
>
<Grid :cols="(((layout as string) === 'split') ? '1-2' : '1')" class="items-start gap-8">
<Form method="dialog" class="w-full gap-4" data-slot="contact-form">
<Field v-if="((fields as string) === 'full')" :label="labels.name" :htmlFor="tpl('{0}-name', id)">
<Input type="text" name="name" autocomplete="name" :id="tpl('{0}-name', id)" data-slot="field" />
</Field>
<Field :label="labels.email" :htmlFor="tpl('{0}-email', id)">
<Input type="email" name="email" autocomplete="email" :id="tpl('{0}-email', id)" data-slot="field" />
</Field>
<Field v-if="((fields as string) === 'full')" :label="labels.subject" :htmlFor="tpl('{0}-subject', id)">
<Input type="text" name="subject" :id="tpl('{0}-subject', id)" data-slot="field" />
</Field>
<Field :label="labels.message" :htmlFor="tpl('{0}-message', id)">
<Textarea :rows="4" name="message" :id="tpl('{0}-message', id)" data-slot="field" />
</Field>
<Group v-if="((terms as string) === 'show')" gap="2" align="center" :class="cn('w-fit', '')">
<Checkbox name="consent" :id="tpl('{0}-consent', id)" />
<Label :for="tpl('{0}-consent', id)" class="text-sm">
{{ labels.consent }}
</Label>
</Group>
<Button variant="default" size="default" type="submit" class="w-fit">
{{ labels.submit }}
</Button>
</Form>
<Stack v-if="(((layout as string) === 'split') && ((details?.length ?? 0) > 0))" gap="4" data-slot="details">
<Group v-for="d in details" :key="d.id" gap="4" align="start" data-slot="detail">
<LucideIcon :name="d.icon" :size="20" />
<Stack gap="0">
<Text size="base" weight="semibold">
{{ d.title }}
</Text>
<Text size="sm" class="text-muted-foreground">
{{ d.text }}
</Text>
</Stack>
</Group>
</Stack>
</Grid>
</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 contact-form// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach
* us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone
* (default, muted).
*/
import { For, type JSX } from "solid-js";
import { Button, Checkbox, Form, Grid, Group, Input, Label, Stack, Text, Textarea } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { Field } from "../components/field";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { ContactLabels } from "./contact-form.types";
import type { Feature } from "./feature-grid.types";
export type ContactFormProps = {
id: string;
title: string;
text: string;
labels: ContactLabels;
details: Feature[];
layout?: "single" | "split";
fields?: "short" | "full";
terms?: "show" | "hide";
level?: 1 | 2;
page?: "section" | "full";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ContactForm({
id,
title,
text,
labels,
details,
layout = "single",
fields = "full",
terms = "hide",
level = 2,
page = "section",
tone = "default",
landmarkLabel,
}: ContactFormProps) {
return (
<SectionFrame
id={id}
title={title}
lead={text}
heading={{ level }}
tone={tone}
density={(((page as string) === "full") ? "roomy" : "default")}
align={(((page as string) === "full") ? "center" : "start")}
measure={(((layout as string) === "single") ? "xl" : "default")}
landmarkLabel={landmarkLabel}
>
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
<Form method="dialog" class="w-full gap-4" data-slot="contact-form">
{((fields as string) === "full") ? (
<Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
<Input type="text" name="name" autocomplete="name" id={tpl("{0}-name", id)} data-slot="field" />
</Field>
) : null}
<Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
{((fields as string) === "full") ? (
<Field label={labels.subject} htmlFor={tpl("{0}-subject", id)}>
<Input type="text" name="subject" id={tpl("{0}-subject", id)} data-slot="field" />
</Field>
) : null}
<Field label={labels.message} htmlFor={tpl("{0}-message", id)}>
<Textarea rows={4} name="message" id={tpl("{0}-message", id)} data-slot="field" />
</Field>
{((terms as string) === "show") ? (
<Group gap="2" align="center" class={cn("w-fit", "")}>
<Checkbox name="consent" id={tpl("{0}-consent", id)} />
<Label for={tpl("{0}-consent", id)} class="text-sm">
{labels.consent}
</Label>
</Group>
) : null}
<Button variant="default" size="default" type="submit" class="w-fit">
{labels.submit}
</Button>
</Form>
{(((layout as string) === "split") && ((details?.length ?? 0) > 0)) ? (
<Stack gap="4" data-slot="details">
<For each={details ?? []}>{(d) => (
<Group gap="4" align="start" data-slot="detail">
<LucideIcon name={d.icon} size={20} />
<Stack gap="0">
<Text size="base" weight="semibold">
{d.title}
</Text>
<Text size="sm" class="text-muted-foreground">
{d.text}
</Text>
</Stack>
</Group>
)}</For>
</Stack>
) : null}
</Grid>
</SectionFrame>
);
}
// 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 ContactLabels = {
name: string;
email: string;
subject: string;
message: string;
consent: string;
submit: string;
};
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 contact-form// 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/contact-form.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/ui/checkbox"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/form"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/input"
"github.com/ui8kit/codegen/generated/templ/ui/label"
"github.com/ui8kit/codegen/generated/templ/ui/text"
"github.com/ui8kit/codegen/generated/templ/ui/textarea"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// ContactFormProps are the props of ContactForm; the values are the JSON shapes of the TypeScript props.
type ContactFormProps struct {
Id any `json:"id"`
Title any `json:"title"`
Text any `json:"text"`
Labels any `json:"labels"`
Details any `json:"details"`
Layout any `json:"layout"`
Fields any `json:"fields"`
Terms any `json:"terms"`
Level any `json:"level"`
Page any `json:"page"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone (default, muted).
templ ContactForm(p ContactFormProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vText := p.Text }}
{{ vLabels := p.Labels }}
{{ vDetails := p.Details }}
{{ vLayout := uiutils.Def(p.Layout, "single") }}
{{ vFields := uiutils.Def(p.Fields, "full") }}
{{ vTerms := uiutils.Def(p.Terms, "hide") }}
{{ vLevel := uiutils.Def(p.Level, float64(2)) }}
{{ vPage := uiutils.Def(p.Page, "section") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vText, Heading: map[string]any{"level": vLevel}, Tone: vTone, Density: uiutils.Cond(uiutils.T(uiutils.Eq(vPage, "full")), "roomy", "default"), Align: uiutils.Cond(uiutils.T(uiutils.Eq(vPage, "full")), "center", "start"), Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "single")), "xl", "default"), LandmarkLabel: vLandmarkLabel}) {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "1-2", "1")), BoxProps: box.BoxProps{Class: "items-start gap-8"}}) {
@compose.Form(compose.FormProps{FormProps: form.FormProps{Method: "dialog", Class: "w-full gap-4", Attrs: uiutils.Attrs("data-slot", "contact-form")}}) {
if uiutils.Eq(vFields, "full") {
@Field(FieldProps{Label: uiutils.Get(vLabels, "name"), HtmlFor: uiutils.Tpl("{0}-name", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "name", Attrs: uiutils.Attrs("autocomplete", "name", "id", uiutils.Tpl("{0}-name", vId), "data-slot", "field")}})
}
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "email"), HtmlFor: uiutils.Tpl("{0}-email", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "email", Name: "email", Attrs: uiutils.Attrs("autocomplete", "email", "id", uiutils.Tpl("{0}-email", vId), "data-slot", "field")}})
}
if uiutils.Eq(vFields, "full") {
@Field(FieldProps{Label: uiutils.Get(vLabels, "subject"), HtmlFor: uiutils.Tpl("{0}-subject", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "subject", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-subject", vId), "data-slot", "field")}})
}
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "message"), HtmlFor: uiutils.Tpl("{0}-message", vId)}) {
@compose.Textarea(compose.TextareaProps{TextareaProps: textarea.TextareaProps{Rows: "4", Name: "message", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-message", vId), "data-slot", "field")}})
}
if uiutils.Eq(vTerms, "show") {
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-fit", ""))}}) {
@compose.Checkbox(compose.CheckboxProps{CheckboxProps: checkbox.CheckboxProps{Name: "consent", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-consent", vId))}})
@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{For: uiutils.S(uiutils.Tpl("{0}-consent", vId)), Class: "text-sm"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "consent")) }
}
}
}
@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Type: "submit", Class: "w-fit"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "submit")) }
}
}
if uiutils.T(uiutils.And(uiutils.Eq(vLayout, "split"), uiutils.Gt(uiutils.Len(vDetails), float64(0)))) {
@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "details")}}) {
for _, vD := range uiutils.L(vDetails) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "start", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "detail")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vD, "icon")), Size: 20})
@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vD, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vD, "text")) }
}
}
}
}
}
}
}
}
}
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 contact-form{#- 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/contact-form.json
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone (default, muted).
Props (p): id, title, text, labels, details, layout, fields, terms, level, page, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_details = (p.details ?? null) -%}
{%- set v_layout = (p.layout ?? 'single') -%}
{%- set v_fields = (p.fields ?? 'full') -%}
{%- set v_terms = (p.terms ?? 'hide') -%}
{%- set v_level = (p.level ?? 2) -%}
{%- set v_page = (p.page ?? 'section') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_15 -%}
{%- set c_14 -%}
{%- set c_8 -%}
{%- if og_t(og_eq(v_fields, 'full')) %}
{%- set c_1 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'name', 'attrs': og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['name']), 'htmlFor': og_tpl('{0}-name', [v_id])}, 'children': og_markup(c_1)}, with_context = false) }}
{%- endif %}
{%- set c_2 -%}
{{ include('compose/Input.html.twig', {'type': 'email', 'name': 'email', 'attrs': og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['email']), 'htmlFor': og_tpl('{0}-email', [v_id])}, 'children': og_markup(c_2)}, with_context = false) }}
{%- if og_t(og_eq(v_fields, 'full')) %}
{%- set c_3 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'subject', 'attrs': og_attrs(['id', og_tpl('{0}-subject', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['subject']), 'htmlFor': og_tpl('{0}-subject', [v_id])}, 'children': og_markup(c_3)}, with_context = false) }}
{%- endif %}
{%- set c_4 -%}
{{ include('compose/Textarea.html.twig', {'rows': 4, 'name': 'message', 'attrs': og_attrs(['id', og_tpl('{0}-message', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['message']), 'htmlFor': og_tpl('{0}-message', [v_id])}, 'children': og_markup(c_4)}, with_context = false) }}
{%- if og_t(og_eq(v_terms, 'show')) %}
{%- set c_6 -%}
{{ include('compose/Checkbox.html.twig', {'name': 'consent', 'attrs': og_attrs(['id', og_tpl('{0}-consent', [v_id])])}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_labels, ['consent'])) }}
{%- endset -%}
{{ include('compose/Label.html.twig', {'htmlFor': og_s(og_tpl('{0}-consent', [v_id])), 'class': 'text-sm', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'class': og_s(og_cnv(['w-fit', ''])), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['submit'])) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'type': 'submit', 'class': 'w-fit', 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('compose/Form.html.twig', {'method': 'dialog', 'class': 'w-full gap-4', 'attrs': og_attrs(['data-slot', 'contact-form']), 'children': c_8}, with_context = false) }}
{%- if og_t(og_and([og_eq(v_layout, 'split'), og_gt(og_len(v_details), 0)])) %}
{%- set c_13 -%}
{%- for v_d in og_l(v_details) %}
{%- set c_12 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_d, ['icon'])), 'size': 20}, with_context = false) }}
{%- set c_11 -%}
{%- set c_9 -%}
{{ og_text(og_get(v_d, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_9}, with_context = false) }}
{%- set c_10 -%}
{{ og_text(og_get(v_d, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_11}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'start', 'attrs': og_attrs(['data-slot', 'detail']), 'children': c_12}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'attrs': og_attrs(['data-slot', 'details']), 'children': c_13}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'split')) ? '1-2' : '1')), 'class': 'items-start gap-8', 'children': c_14}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'heading': {'level': v_level}, 'tone': v_tone, 'density': (og_t(og_eq(v_page, 'full')) ? 'roomy' : 'default'), 'align': (og_t(og_eq(v_page, 'full')) ? 'center' : 'start'), 'measure': (og_t(og_eq(v_layout, 'single')) ? 'xl' : 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_15)}, 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 contact-form{* 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/contact-form.json
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone (default, muted).
Props (p): id, title, text, labels, details, layout, fields, terms, level, page, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_details = ($p['details'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'single')}
{var $v_fields = ($p['fields'] ?? 'full')}
{var $v_terms = ($p['terms'] ?? 'hide')}
{var $v_level = ($p['level'] ?? 2)}
{var $v_page = ($p['page'] ?? 'section')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_15}
{capture $c_14}
{capture $c_8}
{if og_t(og_eq($v_fields, 'full'))}
{capture $c_1}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'name', 'attrs' => og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['name']), 'htmlFor' => og_tpl('{0}-name', [$v_id])], 'children' => og_markup($c_1)])|noescape}
{/if}
{capture $c_2}
{=og_include('compose/Input.latte', ['type' => 'email', 'name' => 'email', 'attrs' => og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['email']), 'htmlFor' => og_tpl('{0}-email', [$v_id])], 'children' => og_markup($c_2)])|noescape}
{if og_t(og_eq($v_fields, 'full'))}
{capture $c_3}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'subject', 'attrs' => og_attrs(['id', og_tpl('{0}-subject', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['subject']), 'htmlFor' => og_tpl('{0}-subject', [$v_id])], 'children' => og_markup($c_3)])|noescape}
{/if}
{capture $c_4}
{=og_include('compose/Textarea.latte', ['rows' => 4, 'name' => 'message', 'attrs' => og_attrs(['id', og_tpl('{0}-message', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['message']), 'htmlFor' => og_tpl('{0}-message', [$v_id])], 'children' => og_markup($c_4)])|noescape}
{if og_t(og_eq($v_terms, 'show'))}
{capture $c_6}
{=og_include('compose/Checkbox.latte', ['name' => 'consent', 'attrs' => og_attrs(['id', og_tpl('{0}-consent', [$v_id])])])|noescape}
{capture $c_5}
{=og_text(og_get($v_labels, ['consent']))}
{/capture}
{=og_include('compose/Label.latte', ['htmlFor' => og_s(og_tpl('{0}-consent', [$v_id])), 'class' => 'text-sm', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'class' => og_s(og_cnv(['w-fit', ''])), 'children' => (string) $c_6])|noescape}
{/if}
{capture $c_7}
{=og_text(og_get($v_labels, ['submit']))}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'type' => 'submit', 'class' => 'w-fit', 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('compose/Form.latte', ['method' => 'dialog', 'class' => 'w-full gap-4', 'attrs' => og_attrs(['data-slot', 'contact-form']), 'children' => (string) $c_8])|noescape}
{if og_t(og_and([og_eq($v_layout, 'split'), og_gt(og_len($v_details), 0)]))}
{capture $c_13}
{foreach og_l($v_details) as $v_d}
{capture $c_12}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_d, ['icon'])), 'size' => 20])|noescape}
{capture $c_11}
{capture $c_9}
{=og_text(og_get($v_d, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_9])|noescape}
{capture $c_10}
{=og_text(og_get($v_d, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_11])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'start', 'attrs' => og_attrs(['data-slot', 'detail']), 'children' => (string) $c_12])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'attrs' => og_attrs(['data-slot', 'details']), 'children' => (string) $c_13])|noescape}
{/if}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'split')) ? '1-2' : '1')), 'class' => 'items-start gap-8', 'children' => (string) $c_14])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_text, 'heading' => ['level' => $v_level], 'tone' => $v_tone, 'density' => (og_t(og_eq($v_page, 'full')) ? 'roomy' : 'default'), 'align' => (og_t(og_eq($v_page, 'full')) ? 'center' : 'start'), 'measure' => (og_t(og_eq($v_layout, 'single')) ? 'xl' : 'default'), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_15)])|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 contact-form{#- 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/contact-form.json
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone (default, muted).
Props (p): id, title, text, labels, details, layout, fields, terms, level, page, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_details = og_def(p['details'], none) -%}
{%- set v_layout = og_def(p['layout'], 'single') -%}
{%- set v_fields = og_def(p['fields'], 'full') -%}
{%- set v_terms = og_def(p['terms'], 'hide') -%}
{%- set v_level = og_def(p['level'], 2) -%}
{%- set v_page = og_def(p['page'], 'section') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_15 -%}
{%- set c_14 -%}
{%- set c_8 -%}
{%- if og_t(og_eq(v_fields, 'full')) %}
{%- set c_1 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'name', 'Attrs': og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['name']), 'htmlFor': og_tpl('{0}-name', [v_id])}, 'children': og_markup(c_1)}) }}
{%- endif %}
{%- set c_2 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'email', 'Name': 'email', 'Attrs': og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['email']), 'htmlFor': og_tpl('{0}-email', [v_id])}, 'children': og_markup(c_2)}) }}
{%- if og_t(og_eq(v_fields, 'full')) %}
{%- set c_3 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'subject', 'Attrs': og_attrs(['id', og_tpl('{0}-subject', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['subject']), 'htmlFor': og_tpl('{0}-subject', [v_id])}, 'children': og_markup(c_3)}) }}
{%- endif %}
{%- set c_4 -%}
{{ og_include('compose/textarea.html.j2', {'p': {'Rows': 4, 'Name': 'message', 'Attrs': og_attrs(['id', og_tpl('{0}-message', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['message']), 'htmlFor': og_tpl('{0}-message', [v_id])}, 'children': og_markup(c_4)}) }}
{%- if og_t(og_eq(v_terms, 'show')) %}
{%- set c_6 -%}
{{ og_include('compose/checkbox.html.j2', {'p': {'Name': 'consent', 'Attrs': og_attrs(['id', og_tpl('{0}-consent', [v_id])])}}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_labels, ['consent'])) }}
{%- endset -%}
{{ og_include('compose/label.html.j2', {'p': {'For': og_s(og_tpl('{0}-consent', [v_id])), 'Class': 'text-sm'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': og_s(og_cnv(['w-fit', '']))}, 'children': c_6}) }}
{%- endif %}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['submit'])) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Type': 'submit', 'Class': 'w-fit'}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('compose/form.html.j2', {'p': {'Method': 'dialog', 'Class': 'w-full gap-4', 'Attrs': og_attrs(['data-slot', 'contact-form'])}, 'children': c_8}) }}
{%- if og_t(og_and([og_eq(v_layout, 'split'), og_gt(og_len(v_details), 0)])) %}
{%- set c_13 -%}
{%- for v_d in og_l(v_details) %}
{%- set c_12 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_d, ['icon'])), 'Size': 20}}) }}
{%- set c_11 -%}
{%- set c_9 -%}
{{ og_text(og_get(v_d, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_9}) }}
{%- set c_10 -%}
{{ og_text(og_get(v_d, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_11}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'start', 'Attrs': og_attrs(['data-slot', 'detail'])}, 'children': c_12}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Attrs': og_attrs(['data-slot', 'details'])}, 'children': c_13}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-2' if og_t(og_eq(v_layout, 'split')) else '1')), 'Class': 'items-start gap-8'}, 'children': c_14}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'heading': {'level': v_level}, 'tone': v_tone, 'density': ('roomy' if og_t(og_eq(v_page, 'full')) else 'default'), 'align': ('center' if og_t(og_eq(v_page, 'full')) else 'start'), 'measure': ('xl' if og_t(og_eq(v_layout, 'single')) else 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_15)}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
A contact section: a form (name, email, subject, message, consent) and, in the split layout, the ways to reach us beside it. Axes: layout (single, split), fields (short: email and message, full), terms (show, hide), tone (default, muted).
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| text (required) | string | - | |
| labels (required) | ContactLabels | - | |
| details (required) | Feature[] | - | the ways to reach us, shown beside the form in the split layout |
| layout | "single" | "split" | "single" | |
| fields | "short" | "full" | "full" | |
| terms | "show" | "hide" | "hide" | |
| level | 1 | 2 | 2 | |
| page | "section" | "full" | "section" | full: a page of its own, a narrow form in the middle with a roomy heading |
| 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 |