Form Message
Form Message primitive
Install
npx ui8kit add form-messagePulls in: kit-text, recipes, utils
Preview
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 form-messagecompose/FormMessage.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- FormMessage: Text <p> + recipe form-message. -->
<script lang="ts">
import type { ComponentProps, Snippet } from "svelte";
import Prim from "../kit/ui/text/Text.svelte";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
let { class: className, children, ...rest }: Omit<ComponentProps<typeof Prim>, "tag"> & { class?: string; children?: Snippet } = $props();
const cls = $derived(cn(rc("form-message", { }), className));
</script>
<Prim tag={"p" as never} class={cls} {...rest}>{@render children?.()}</Prim>
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 form-messagecompose/form-message.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Text as Prim } from "../kit/ui/text/text";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type FormMessageProps = Omit<ComponentProps<typeof Prim>, "tag"> & { className?: string };
/** FormMessage: Text <p> + recipe form-message. */
export function FormMessage({ className, ...rest }: FormMessageProps) {
return <Prim tag={"p" as never} className={cn(rc("form-message", { }), className)} {...rest} />;
}
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 form-messagecompose/FormMessage.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- FormMessage: Text <p> + recipe form-message. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/text/Text.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
defineOptions({ name: "FormMessage", inheritAttrs: false });
const props = defineProps<{ }>();
const attrs = useAttrs();
const rest = computed(() => {
const { class: _class, ...r } = attrs;
return r;
});
const cls = computed(() => cn(rc("form-message", { }), attrs.class as string | undefined));
const tagValue = computed(() => "p");
</script>
<template>
<Prim :tag="tagValue as never" :class="cls" v-bind="rest"><slot /></Prim>
</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 form-messagecompose/form-message.solid.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import { splitProps, type ComponentProps } from "solid-js";
import { Text as Prim } from "../kit/ui/text/text.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type FormMessageProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className"> & { class?: string; className?: string };
/** FormMessage: Text <p> + recipe form-message. */
export function FormMessage(props: FormMessageProps) {
const [local, rest] = splitProps(props, ["class", "className"]);
return <Prim tag={"p" as never} class={cn(rc("form-message", { }), local.class ?? local.className)} {...rest} />;
}
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 form-messagecompose/form-message.templ
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
package compose
import "github.com/ui8kit/codegen/generated/templ/ui/text"
// FormMessageProps: FormMessage: Text <p> + recipe form-message.
type FormMessageProps struct {
text.TextProps
}
func formMessageInner(p FormMessageProps) text.TextProps {
in := p.TextProps
in.Class = Join(Rc("form-message", map[string]string{}), p.TextProps.Class)
in.Tag = "p"
return in
}
// FormMessage renders Text with the composition classes.
templ FormMessage(p FormMessageProps) {
@text.Text(formMessageInner(p)) {
{ children... }
}
}
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 form-messagecompose/FormMessage.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# FormMessage: Text <p> + recipe form-message. Params: class, attrs + the params of Text. #}
{% include 'ui/text/Text.html.twig' with compose_props('FormMessage', _context) only %}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 form-messagecompose/FormMessage.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* FormMessage: Text <p> + recipe form-message. *}
{parameters
string $class = '',
string $tag = '',
array $attrs = [],
string $children = '',
}
{include '../ui/text/Text.latte', ...\CodegenX\Compose\Latte\Compose::props('FormMessage', ['class' => $class, 'tag' => $tag, 'attrs' => $attrs, 'children' => $children])}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 form-messagecompose/form-message.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
FormMessage: Text <p> + recipe form-message. Props (p): Class, Attrs + the props of Text. -#}
{%- with p = compose_props('FormMessage', p) %}{% include 'ui/text/text.html.j2' %}{% endwith %}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.
No props.