Profile Form
Account settings: picture, name, email, bio and notifications.
Install
npx ui8kit add profile-formPulls in: block, button, compose, container, field, form, grid, group, input, kit-box, kit-button, kit-form, kit-input, kit-label, kit-switch, kit-text, kit-textarea, label, media-frame, panel, stack, switch, textarea, title, utils
Preview
Profile
Your name and email appear on invoices and in comments.
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 profile-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. -->
<!--
An account settings form: a picture with a change button, name, email, bio and two notification switches, with
save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default,
muted).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { ProfileLabels } from "./profile-form.types";
export type ProfileFormProps = {
id: string;
title: string;
text: string;
labels: ProfileLabels;
layout?: "stacked" | "split";
avatar?: "show" | "hide";
prefs?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Button from "../compose/Button.svelte";
import Container from "../compose/Container.svelte";
import 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 Stack from "../compose/Stack.svelte";
import Switch from "../compose/Switch.svelte";
import Textarea from "../compose/Textarea.svelte";
import Title from "../compose/Title.svelte";
import Field from "../components/field.svelte";
import MediaFrame from "../components/media-frame.svelte";
import Panel from "../components/panel.svelte";
import { cn, tpl } from "../utils";
let {
id,
title,
text,
labels,
layout = "stacked",
avatar = "show",
prefs = "show",
tone = "default",
landmarkLabel,
}: ProfileFormProps = $props();
</script>
<Block
tag="section"
aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
aria-label={landmarkLabel}
data-slot="panel-section"
>
<Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
<Panel title={title} description={text} id={id} class={cn((((tone as string) === "muted") ? "bg-muted" : ""))}>
<Form method="dialog" class="gap-6" data-slot="profile-form">
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
<Stack gap="4" align="stretch">
{#if ((avatar as string) === "show")}
<Group gap="4" align="center" data-slot="avatar">
<MediaFrame alt={labels.picture} ratio="1/1" class="size-16 shrink-0 rounded-full" />
<Button variant="outline" size="sm" type="button">
{labels.change}
</Button>
</Group>
{/if}
<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>
<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 label={labels.bio} htmlFor={tpl("{0}-bio", id)}>
<Textarea rows={4} name="bio" id={tpl("{0}-bio", id)} data-slot="field" />
</Field>
</Stack>
{#if ((prefs as string) === "show")}
<Stack gap="4" align="stretch" data-slot="prefs">
<Title as={3} size="base" weight="bold">
{labels.prefs}
</Title>
<Group gap="4" align="center" justify="between">
<Label for={tpl("{0}-updates", id)} class="text-sm" id={tpl("{0}-updates-label", id)}>
{labels.updates}
</Label>
<Switch name="updates" id={tpl("{0}-updates", id)} aria-labelledby={tpl("{0}-updates-label", id)} />
</Group>
<Group gap="4" align="center" justify="between">
<Label for={tpl("{0}-alerts", id)} class="text-sm" id={tpl("{0}-alerts-label", id)}>
{labels.alerts}
</Label>
<Switch name="alerts" id={tpl("{0}-alerts", id)} aria-labelledby={tpl("{0}-alerts-label", id)} />
</Group>
</Stack>
{/if}
</Grid>
<Group gap="2" class="flex-wrap">
<Button variant="default" size="default" type="submit">
{labels.save}
</Button>
<Button variant="outline" size="default" type="button">
{labels.cancel}
</Button>
</Group>
</Form>
</Panel>
</Container>
</Block>
// 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 ProfileLabels = {
picture: string;
change: string;
name: string;
email: string;
bio: string;
prefs: string;
updates: string;
alerts: string;
save: string;
cancel: 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 profile-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.
/**
* An account settings form: a picture with a change button, name, email, bio and two notification switches, with
* save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default,
* muted).
*/
import { type ReactNode } from "react";
import { Block, Button, Container, Form, Grid, Group, Input, Label, Stack, Switch, Textarea, Title } from "../compose";
import { Field } from "../components/field";
import { MediaFrame } from "../components/media-frame";
import { Panel } from "../components/panel";
import { cn, tpl } from "../utils";
import type { ProfileLabels } from "./profile-form.types";
export type ProfileFormProps = {
id: string;
title: string;
text: string;
labels: ProfileLabels;
layout?: "stacked" | "split";
avatar?: "show" | "hide";
prefs?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ProfileForm({
id,
title,
text,
labels,
layout = "stacked",
avatar = "show",
prefs = "show",
tone = "default",
landmarkLabel,
}: ProfileFormProps) {
return (
<Block
tag="section"
aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
aria-label={landmarkLabel}
data-slot="panel-section"
>
<Container className="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
<Panel
title={title}
description={text}
id={id}
className={cn((((tone as string) === "muted") ? "bg-muted" : ""))}
>
<Form method="dialog" className="gap-6" data-slot="profile-form">
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} className="items-start gap-8">
<Stack gap="4" align="stretch">
{((avatar as string) === "show") ? (
<Group gap="4" align="center" data-slot="avatar">
<MediaFrame alt={labels.picture} ratio="1/1" className="size-16 shrink-0 rounded-full" />
<Button variant="outline" size="sm" type="button">
{labels.change}
</Button>
</Group>
) : null}
<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>
<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 label={labels.bio} htmlFor={tpl("{0}-bio", id)}>
<Textarea rows={4} name="bio" id={tpl("{0}-bio", id)} data-slot="field" />
</Field>
</Stack>
{((prefs as string) === "show") ? (
<Stack gap="4" align="stretch" data-slot="prefs">
<Title as={3} size="base" weight="bold">
{labels.prefs}
</Title>
<Group gap="4" align="center" justify="between">
<Label htmlFor={tpl("{0}-updates", id)} className="text-sm" id={tpl("{0}-updates-label", id)}>
{labels.updates}
</Label>
<Switch name="updates" id={tpl("{0}-updates", id)} aria-labelledby={tpl("{0}-updates-label", id)} />
</Group>
<Group gap="4" align="center" justify="between">
<Label htmlFor={tpl("{0}-alerts", id)} className="text-sm" id={tpl("{0}-alerts-label", id)}>
{labels.alerts}
</Label>
<Switch name="alerts" id={tpl("{0}-alerts", id)} aria-labelledby={tpl("{0}-alerts-label", id)} />
</Group>
</Stack>
) : null}
</Grid>
<Group gap="2" className="flex-wrap">
<Button variant="default" size="default" type="submit">
{labels.save}
</Button>
<Button variant="outline" size="default" type="button">
{labels.cancel}
</Button>
</Group>
</Form>
</Panel>
</Container>
</Block>
);
}
// 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 ProfileLabels = {
picture: string;
change: string;
name: string;
email: string;
bio: string;
prefs: string;
updates: string;
alerts: string;
save: string;
cancel: 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 profile-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 ProfileLabels = {
picture: string;
change: string;
name: string;
email: string;
bio: string;
prefs: string;
updates: string;
alerts: string;
save: string;
cancel: 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. -->
<!--
An account settings form: a picture with a change button, name, email, bio and two notification switches, with
save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default,
muted).
-->
<script lang="ts">
import type { ProfileLabels } from "./profile-form.types";
export type ProfileFormProps = {
id: string;
title: string;
text: string;
labels: ProfileLabels;
layout?: "stacked" | "split";
avatar?: "show" | "hide";
prefs?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Button from "../compose/Button.vue";
import Container from "../compose/Container.vue";
import 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 Stack from "../compose/Stack.vue";
import Switch from "../compose/Switch.vue";
import Textarea from "../compose/Textarea.vue";
import Title from "../compose/Title.vue";
import Field from "../components/field.vue";
import MediaFrame from "../components/media-frame.vue";
import Panel from "../components/panel.vue";
import { cn, tpl } from "../utils";
const {
id,
title,
text,
labels,
layout = "stacked",
avatar = "show",
prefs = "show",
tone = "default",
landmarkLabel,
} = defineProps<ProfileFormProps>();
</script>
<template>
<Block
tag="section"
:aria-labelledby="(landmarkLabel ? undefined : ((title && id) ? tpl('{0}-t', id) : undefined))"
:aria-label="landmarkLabel"
data-slot="panel-section"
>
<Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
<Panel
:title="title"
:description="text"
:id="id"
:class="cn((((tone as string) === 'muted') ? 'bg-muted' : ''))"
>
<Form method="dialog" class="gap-6" data-slot="profile-form">
<Grid :cols="(((layout as string) === 'split') ? '1-2' : '1')" class="items-start gap-8">
<Stack gap="4" align="stretch">
<Group v-if="((avatar as string) === 'show')" gap="4" align="center" data-slot="avatar">
<MediaFrame :alt="labels.picture" ratio="1/1" class="size-16 shrink-0 rounded-full" />
<Button variant="outline" size="sm" type="button">
{{ labels.change }}
</Button>
</Group>
<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>
<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 :label="labels.bio" :htmlFor="tpl('{0}-bio', id)">
<Textarea :rows="4" name="bio" :id="tpl('{0}-bio', id)" data-slot="field" />
</Field>
</Stack>
<Stack v-if="((prefs as string) === 'show')" gap="4" align="stretch" data-slot="prefs">
<Title :as="3" size="base" weight="bold">
{{ labels.prefs }}
</Title>
<Group gap="4" align="center" justify="between">
<Label :for="tpl('{0}-updates', id)" class="text-sm" :id="tpl('{0}-updates-label', id)">
{{ labels.updates }}
</Label>
<Switch name="updates" :id="tpl('{0}-updates', id)" :aria-labelledby="tpl('{0}-updates-label', id)" />
</Group>
<Group gap="4" align="center" justify="between">
<Label :for="tpl('{0}-alerts', id)" class="text-sm" :id="tpl('{0}-alerts-label', id)">
{{ labels.alerts }}
</Label>
<Switch name="alerts" :id="tpl('{0}-alerts', id)" :aria-labelledby="tpl('{0}-alerts-label', id)" />
</Group>
</Stack>
</Grid>
<Group gap="2" class="flex-wrap">
<Button variant="default" size="default" type="submit">
{{ labels.save }}
</Button>
<Button variant="outline" size="default" type="button">
{{ labels.cancel }}
</Button>
</Group>
</Form>
</Panel>
</Container>
</Block>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add profile-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.
/**
* An account settings form: a picture with a change button, name, email, bio and two notification switches, with
* save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default,
* muted).
*/
import { For, type JSX } from "solid-js";
import { Block, Button, Container, Form, Grid, Group, Input, Label, Stack, Switch, Textarea, Title } from "../compose";
import { Field } from "../components/field";
import { MediaFrame } from "../components/media-frame";
import { Panel } from "../components/panel";
import { cn, tpl } from "../utils";
import type { ProfileLabels } from "./profile-form.types";
export type ProfileFormProps = {
id: string;
title: string;
text: string;
labels: ProfileLabels;
layout?: "stacked" | "split";
avatar?: "show" | "hide";
prefs?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ProfileForm({
id,
title,
text,
labels,
layout = "stacked",
avatar = "show",
prefs = "show",
tone = "default",
landmarkLabel,
}: ProfileFormProps) {
return (
<Block
tag="section"
aria-labelledby={(landmarkLabel ? undefined : ((title && id) ? tpl("{0}-t", id) : undefined))}
aria-label={landmarkLabel}
data-slot="panel-section"
>
<Container class="mx-auto w-full max-w-6xl px-4 py-8" data-slot="container">
<Panel title={title} description={text} id={id} class={cn((((tone as string) === "muted") ? "bg-muted" : ""))}>
<Form method="dialog" class="gap-6" data-slot="profile-form">
<Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
<Stack gap="4" align="stretch">
{((avatar as string) === "show") ? (
<Group gap="4" align="center" data-slot="avatar">
<MediaFrame alt={labels.picture} ratio="1/1" class="size-16 shrink-0 rounded-full" />
<Button variant="outline" size="sm" type="button">
{labels.change}
</Button>
</Group>
) : null}
<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>
<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 label={labels.bio} htmlFor={tpl("{0}-bio", id)}>
<Textarea rows={4} name="bio" id={tpl("{0}-bio", id)} data-slot="field" />
</Field>
</Stack>
{((prefs as string) === "show") ? (
<Stack gap="4" align="stretch" data-slot="prefs">
<Title as={3} size="base" weight="bold">
{labels.prefs}
</Title>
<Group gap="4" align="center" justify="between">
<Label for={tpl("{0}-updates", id)} class="text-sm" id={tpl("{0}-updates-label", id)}>
{labels.updates}
</Label>
<Switch name="updates" id={tpl("{0}-updates", id)} aria-labelledby={tpl("{0}-updates-label", id)} />
</Group>
<Group gap="4" align="center" justify="between">
<Label for={tpl("{0}-alerts", id)} class="text-sm" id={tpl("{0}-alerts-label", id)}>
{labels.alerts}
</Label>
<Switch name="alerts" id={tpl("{0}-alerts", id)} aria-labelledby={tpl("{0}-alerts-label", id)} />
</Group>
</Stack>
) : null}
</Grid>
<Group gap="2" class="flex-wrap">
<Button variant="default" size="default" type="submit">
{labels.save}
</Button>
<Button variant="outline" size="default" type="button">
{labels.cancel}
</Button>
</Group>
</Form>
</Panel>
</Container>
</Block>
);
}
// 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 ProfileLabels = {
picture: string;
change: string;
name: string;
email: string;
bio: string;
prefs: string;
updates: string;
alerts: string;
save: string;
cancel: 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 profile-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/profile-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/compose"
"github.com/ui8kit/codegen/generated/templ/ui/form"
formswitch "github.com/ui8kit/codegen/generated/templ/ui/switch"
"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"
)
// ProfileFormProps are the props of ProfileForm; the values are the JSON shapes of the TypeScript props.
type ProfileFormProps struct {
Id any `json:"id"`
Title any `json:"title"`
Text any `json:"text"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Avatar any `json:"avatar"`
Prefs any `json:"prefs"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// An account settings form: a picture with a change button, name, email, bio and two notification switches, with save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default, muted).
templ ProfileForm(p ProfileFormProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vText := p.Text }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "stacked") }}
{{ vAvatar := uiutils.Def(p.Avatar, "show") }}
{{ vPrefs := uiutils.Def(p.Prefs, "show") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Attrs: uiutils.Attrs("aria-labelledby", uiutils.Cond(uiutils.T(vLandmarkLabel), nil, uiutils.Cond(uiutils.T(uiutils.And(vTitle, vId)), uiutils.Tpl("{0}-t", vId), nil)), "aria-label", vLandmarkLabel, "data-slot", "panel-section")}}) {
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: "mx-auto w-full max-w-6xl px-4 py-8", Attrs: uiutils.Attrs("data-slot", "container")}}) {
@Panel(PanelProps{Title: vTitle, Description: vText, Id: vId, Class: uiutils.Cnv(uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vTone, "muted")), "bg-muted", "")))}) {
@compose.Form(compose.FormProps{FormProps: form.FormProps{Method: "dialog", Class: "gap-6", Attrs: uiutils.Attrs("data-slot", "profile-form")}}) {
@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.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{}}) {
if uiutils.Eq(vAvatar, "show") {
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "avatar")}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vLabels, "picture"), Ratio: "1/1", Class: uiutils.Cnv("size-16 shrink-0 rounded-full")})
@compose.Button(compose.ButtonProps{Variant: "outline", Size: "sm", ButtonProps: button.ButtonProps{Type: "button"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "change")) }
}
}
}
@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")}})
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "bio"), HtmlFor: uiutils.Tpl("{0}-bio", vId)}) {
@compose.Textarea(compose.TextareaProps{TextareaProps: textarea.TextareaProps{Rows: "4", Name: "bio", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-bio", vId), "data-slot", "field")}})
}
}
if uiutils.Eq(vPrefs, "show") {
@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "prefs")}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vLabels, "prefs")) }
}
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{For: uiutils.S(uiutils.Tpl("{0}-updates", vId)), Class: "text-sm", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-updates-label", vId))}}) {
{ uiutils.Text(uiutils.Get(vLabels, "updates")) }
}
@compose.Switch(compose.SwitchProps{SwitchProps: formswitch.SwitchProps{Name: "updates", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-updates", vId), "aria-labelledby", uiutils.Tpl("{0}-updates-label", vId))}})
}
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{For: uiutils.S(uiutils.Tpl("{0}-alerts", vId)), Class: "text-sm", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-alerts-label", vId))}}) {
{ uiutils.Text(uiutils.Get(vLabels, "alerts")) }
}
@compose.Switch(compose.SwitchProps{SwitchProps: formswitch.SwitchProps{Name: "alerts", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-alerts", vId), "aria-labelledby", uiutils.Tpl("{0}-alerts-label", vId))}})
}
}
}
}
@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Type: "submit"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "save")) }
}
@compose.Button(compose.ButtonProps{Variant: "outline", Size: "default", ButtonProps: button.ButtonProps{Type: "button"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "cancel")) }
}
}
}
}
}
}
}
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 profile-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/profile-form.json
An account settings form: a picture with a change button, name, email, bio and two notification switches, with save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default, muted).
Props (p): id, title, text, labels, layout, avatar, prefs, 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_layout = (p.layout ?? 'stacked') -%}
{%- set v_avatar = (p.avatar ?? 'show') -%}
{%- set v_prefs = (p.prefs ?? 'show') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_20 -%}
{%- set c_19 -%}
{%- set c_18 -%}
{%- set c_17 -%}
{%- set c_13 -%}
{%- set c_6 -%}
{%- if og_t(og_eq(v_avatar, 'show')) %}
{%- set c_2 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_labels, ['picture']), 'ratio': '1/1', 'className': og_cnv(['size-16 shrink-0 rounded-full'])}}, with_context = false) }}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['change'])) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'sm', 'type': 'button', 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'attrs': og_attrs(['data-slot', 'avatar']), 'children': c_2}, with_context = false) }}
{%- endif %}
{%- set c_3 -%}
{{ 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_3)}, with_context = false) }}
{%- set c_4 -%}
{{ 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_4)}, with_context = false) }}
{%- set c_5 -%}
{{ include('compose/Textarea.html.twig', {'rows': 4, 'name': 'bio', 'attrs': og_attrs(['id', og_tpl('{0}-bio', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['bio']), 'htmlFor': og_tpl('{0}-bio', [v_id])}, 'children': og_markup(c_5)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'children': c_6}, with_context = false) }}
{%- if og_t(og_eq(v_prefs, 'show')) %}
{%- set c_12 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['prefs'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'bold', 'children': c_7}, with_context = false) }}
{%- set c_9 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['updates'])) }}
{%- endset -%}
{{ include('compose/Label.html.twig', {'htmlFor': og_s(og_tpl('{0}-updates', [v_id])), 'class': 'text-sm', 'attrs': og_attrs(['id', og_tpl('{0}-updates-label', [v_id])]), 'children': c_8}, with_context = false) }}
{{ include('compose/Switch.html.twig', {'name': 'updates', 'attrs': og_attrs(['id', og_tpl('{0}-updates', [v_id]), 'aria-labelledby', og_tpl('{0}-updates-label', [v_id])])}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'children': c_9}, with_context = false) }}
{%- set c_11 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_labels, ['alerts'])) }}
{%- endset -%}
{{ include('compose/Label.html.twig', {'htmlFor': og_s(og_tpl('{0}-alerts', [v_id])), 'class': 'text-sm', 'attrs': og_attrs(['id', og_tpl('{0}-alerts-label', [v_id])]), 'children': c_10}, with_context = false) }}
{{ include('compose/Switch.html.twig', {'name': 'alerts', 'attrs': og_attrs(['id', og_tpl('{0}-alerts', [v_id]), 'aria-labelledby', og_tpl('{0}-alerts-label', [v_id])])}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'children': c_11}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'prefs']), 'children': c_12}, 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_13}, with_context = false) }}
{%- set c_16 -%}
{%- set c_14 -%}
{{ og_text(og_get(v_labels, ['save'])) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'type': 'submit', 'children': c_14}, with_context = false) }}
{%- set c_15 -%}
{{ og_text(og_get(v_labels, ['cancel'])) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'default', 'type': 'button', 'children': c_15}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'class': 'flex-wrap', 'children': c_16}, with_context = false) }}
{%- endset -%}
{{ include('compose/Form.html.twig', {'method': 'dialog', 'class': 'gap-6', 'attrs': og_attrs(['data-slot', 'profile-form']), 'children': c_17}, with_context = false) }}
{%- endset -%}
{{ include('blocks/panel.html.twig', {'p': {'title': v_title, 'description': v_text, 'id': v_id, 'className': og_cnv([og_cnv([(og_t(og_eq(v_tone, 'muted')) ? 'bg-muted' : '')])])}, 'children': og_markup(c_18)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': 'mx-auto w-full max-w-6xl px-4 py-8', 'attrs': og_attrs(['data-slot', 'container']), 'children': c_19}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'attrs': og_attrs(['aria-labelledby', (og_t(v_landmarkLabel) ? null : (og_t(og_and([v_title, v_id])) ? og_tpl('{0}-t', [v_id]) : null)), 'aria-label', v_landmarkLabel, 'data-slot', 'panel-section']), 'children': c_20}, 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 profile-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/profile-form.json
An account settings form: a picture with a change button, name, email, bio and two notification switches, with save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default, muted).
Props (p): id, title, text, labels, layout, avatar, prefs, 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_layout = ($p['layout'] ?? 'stacked')}
{var $v_avatar = ($p['avatar'] ?? 'show')}
{var $v_prefs = ($p['prefs'] ?? 'show')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_20}
{capture $c_19}
{capture $c_18}
{capture $c_17}
{capture $c_13}
{capture $c_6}
{if og_t(og_eq($v_avatar, 'show'))}
{capture $c_2}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_labels, ['picture']), 'ratio' => '1/1', 'className' => og_cnv(['size-16 shrink-0 rounded-full'])]])|noescape}
{capture $c_1}
{=og_text(og_get($v_labels, ['change']))}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'sm', 'type' => 'button', 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'attrs' => og_attrs(['data-slot', 'avatar']), 'children' => (string) $c_2])|noescape}
{/if}
{capture $c_3}
{=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_3)])|noescape}
{capture $c_4}
{=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_4)])|noescape}
{capture $c_5}
{=og_include('compose/Textarea.latte', ['rows' => 4, 'name' => 'bio', 'attrs' => og_attrs(['id', og_tpl('{0}-bio', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['bio']), 'htmlFor' => og_tpl('{0}-bio', [$v_id])], 'children' => og_markup($c_5)])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'children' => (string) $c_6])|noescape}
{if og_t(og_eq($v_prefs, 'show'))}
{capture $c_12}
{capture $c_7}
{=og_text(og_get($v_labels, ['prefs']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'bold', 'children' => (string) $c_7])|noescape}
{capture $c_9}
{capture $c_8}
{=og_text(og_get($v_labels, ['updates']))}
{/capture}
{=og_include('compose/Label.latte', ['htmlFor' => og_s(og_tpl('{0}-updates', [$v_id])), 'class' => 'text-sm', 'attrs' => og_attrs(['id', og_tpl('{0}-updates-label', [$v_id])]), 'children' => (string) $c_8])|noescape}
{=og_include('compose/Switch.latte', ['name' => 'updates', 'attrs' => og_attrs(['id', og_tpl('{0}-updates', [$v_id]), 'aria-labelledby', og_tpl('{0}-updates-label', [$v_id])])])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_9])|noescape}
{capture $c_11}
{capture $c_10}
{=og_text(og_get($v_labels, ['alerts']))}
{/capture}
{=og_include('compose/Label.latte', ['htmlFor' => og_s(og_tpl('{0}-alerts', [$v_id])), 'class' => 'text-sm', 'attrs' => og_attrs(['id', og_tpl('{0}-alerts-label', [$v_id])]), 'children' => (string) $c_10])|noescape}
{=og_include('compose/Switch.latte', ['name' => 'alerts', 'attrs' => og_attrs(['id', og_tpl('{0}-alerts', [$v_id]), 'aria-labelledby', og_tpl('{0}-alerts-label', [$v_id])])])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_11])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'prefs']), 'children' => (string) $c_12])|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_13])|noescape}
{capture $c_16}
{capture $c_14}
{=og_text(og_get($v_labels, ['save']))}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'type' => 'submit', 'children' => (string) $c_14])|noescape}
{capture $c_15}
{=og_text(og_get($v_labels, ['cancel']))}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'default', 'type' => 'button', 'children' => (string) $c_15])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'class' => 'flex-wrap', 'children' => (string) $c_16])|noescape}
{/capture}
{=og_include('compose/Form.latte', ['method' => 'dialog', 'class' => 'gap-6', 'attrs' => og_attrs(['data-slot', 'profile-form']), 'children' => (string) $c_17])|noescape}
{/capture}
{=og_include('blocks/panel.latte', ['p' => ['title' => $v_title, 'description' => $v_text, 'id' => $v_id, 'className' => og_cnv([og_cnv([(og_t(og_eq($v_tone, 'muted')) ? 'bg-muted' : '')])])], 'children' => og_markup($c_18)])|noescape}
{/capture}
{=og_include('compose/Container.latte', ['class' => 'mx-auto w-full max-w-6xl px-4 py-8', 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_19])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'attrs' => og_attrs(['aria-labelledby', (og_t($v_landmarkLabel) ? null : (og_t(og_and([$v_title, $v_id])) ? og_tpl('{0}-t', [$v_id]) : null)), 'aria-label', $v_landmarkLabel, 'data-slot', 'panel-section']), 'children' => (string) $c_20])|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 profile-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/profile-form.json
An account settings form: a picture with a change button, name, email, bio and two notification switches, with save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default, muted).
Props (p): id, title, text, labels, layout, avatar, prefs, 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_layout = og_def(p['layout'], 'stacked') -%}
{%- set v_avatar = og_def(p['avatar'], 'show') -%}
{%- set v_prefs = og_def(p['prefs'], 'show') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_20 -%}
{%- set c_19 -%}
{%- set c_18 -%}
{%- set c_17 -%}
{%- set c_13 -%}
{%- set c_6 -%}
{%- if og_t(og_eq(v_avatar, 'show')) %}
{%- set c_2 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_labels, ['picture']), 'ratio': '1/1', 'className': og_cnv(['size-16 shrink-0 rounded-full'])}}) }}
{%- set c_1 -%}
{{ og_text(og_get(v_labels, ['change'])) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm', 'Type': 'button'}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Attrs': og_attrs(['data-slot', 'avatar'])}, 'children': c_2}) }}
{%- endif %}
{%- set c_3 -%}
{{ 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_3)}) }}
{%- set c_4 -%}
{{ 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_4)}) }}
{%- set c_5 -%}
{{ og_include('compose/textarea.html.j2', {'p': {'Rows': 4, 'Name': 'bio', 'Attrs': og_attrs(['id', og_tpl('{0}-bio', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['bio']), 'htmlFor': og_tpl('{0}-bio', [v_id])}, 'children': og_markup(c_5)}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch'}, 'children': c_6}) }}
{%- if og_t(og_eq(v_prefs, 'show')) %}
{%- set c_12 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_labels, ['prefs'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'bold'}, 'children': c_7}) }}
{%- set c_9 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['updates'])) }}
{%- endset -%}
{{ og_include('compose/label.html.j2', {'p': {'For': og_s(og_tpl('{0}-updates', [v_id])), 'Class': 'text-sm', 'Attrs': og_attrs(['id', og_tpl('{0}-updates-label', [v_id])])}, 'children': c_8}) }}
{{ og_include('compose/switch.html.j2', {'p': {'Name': 'updates', 'Attrs': og_attrs(['id', og_tpl('{0}-updates', [v_id]), 'aria-labelledby', og_tpl('{0}-updates-label', [v_id])])}}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between'}, 'children': c_9}) }}
{%- set c_11 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_labels, ['alerts'])) }}
{%- endset -%}
{{ og_include('compose/label.html.j2', {'p': {'For': og_s(og_tpl('{0}-alerts', [v_id])), 'Class': 'text-sm', 'Attrs': og_attrs(['id', og_tpl('{0}-alerts-label', [v_id])])}, 'children': c_10}) }}
{{ og_include('compose/switch.html.j2', {'p': {'Name': 'alerts', 'Attrs': og_attrs(['id', og_tpl('{0}-alerts', [v_id]), 'aria-labelledby', og_tpl('{0}-alerts-label', [v_id])])}}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between'}, 'children': c_11}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'prefs'])}, 'children': c_12}) }}
{%- 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_13}) }}
{%- set c_16 -%}
{%- set c_14 -%}
{{ og_text(og_get(v_labels, ['save'])) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Type': 'submit'}, 'children': c_14}) }}
{%- set c_15 -%}
{{ og_text(og_get(v_labels, ['cancel'])) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'default', 'Type': 'button'}, 'children': c_15}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Class': 'flex-wrap'}, 'children': c_16}) }}
{%- endset -%}
{{ og_include('compose/form.html.j2', {'p': {'Method': 'dialog', 'Class': 'gap-6', 'Attrs': og_attrs(['data-slot', 'profile-form'])}, 'children': c_17}) }}
{%- endset -%}
{{ og_include('blocks/panel.html.j2', {'p': {'title': v_title, 'description': v_text, 'id': v_id, 'className': og_cnv([og_cnv([('bg-muted' if og_t(og_eq(v_tone, 'muted')) else '')])])}, 'children': og_markup(c_18)}) }}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': 'mx-auto w-full max-w-6xl px-4 py-8', 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_19}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Attrs': og_attrs(['aria-labelledby', (none if og_t(v_landmarkLabel) else (og_tpl('{0}-t', [v_id]) if og_t(og_and([v_title, v_id])) else none)), 'aria-label', v_landmarkLabel, 'data-slot', 'panel-section'])}, 'children': c_20}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
An account settings form: a picture with a change button, name, email, bio and two notification switches, with save and cancel. Axes: layout (stacked, split), avatar (show, hide), prefs (show, hide), tone (default, muted).
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| text (required) | string | - | |
| labels (required) | ProfileLabels | - | |
| layout | "stacked" | "split" | "stacked" | |
| avatar | "show" | "hide" | "show" | |
| prefs | "show" | "hide" | "show" | |
| 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 |