Label
Label primitive
Install
npx ui8kit add labelPulls in: kit-label, 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 labelcompose/Label.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Label: Label + recipe label. -->
<script lang="ts">
import type { ComponentProps, Snippet } from "svelte";
import Prim from "../kit/ui/label/Label.svelte";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
let { class: className, children, ...rest }: ComponentProps<typeof Prim> & { class?: string; children?: Snippet } = $props();
const cls = $derived(cn(rc("label", { }), className));
</script>
<Prim 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 labelcompose/label.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Label as Prim } from "../kit/ui/label/label";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type LabelProps = Omit<ComponentProps<typeof Prim>, "tag"> & { className?: string };
/** Label: Label + recipe label. */
export function Label({ className, ...rest }: LabelProps) {
return <Prim className={cn(rc("label", { }), 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 labelcompose/Label.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Label: Label + recipe label. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/label/Label.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
defineOptions({ name: "Label", inheritAttrs: false });
const props = defineProps<{ }>();
const attrs = useAttrs();
const rest = computed(() => {
const { class: _class, ...r } = attrs;
return r;
});
const cls = computed(() => cn(rc("label", { }), attrs.class as string | undefined));
const tagValue = computed(() => "");
</script>
<template>
<Prim :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 labelcompose/label.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 { Label as Prim } from "../kit/ui/label/label.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type LabelProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className"> & { class?: string; className?: string };
/** Label: Label + recipe label. */
export function Label(props: LabelProps) {
const [local, rest] = splitProps(props, ["class", "className"]);
return <Prim class={cn(rc("label", { }), 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 labelcompose/label.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/label"
// LabelProps: Label: Label + recipe label.
type LabelProps struct {
label.LabelProps
}
func labelInner(p LabelProps) label.LabelProps {
in := p.LabelProps
in.Class = Join(Rc("label", map[string]string{}), p.LabelProps.Class)
return in
}
// Label renders Label with the composition classes.
templ Label(p LabelProps) {
@label.Label(labelInner(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 labelcompose/Label.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Label: Label + recipe label. Params: class, attrs + the params of Label. #}
{% include 'ui/label/Label.html.twig' with compose_props('Label', _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 labelcompose/Label.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Label: Label + recipe label. *}
{parameters
string $class = '',
?string $htmlFor = null,
array $attrs = [],
string $children = '',
}
{include '../ui/label/Label.latte', ...\CodegenX\Compose\Latte\Compose::props('Label', ['class' => $class, 'htmlFor' => $htmlFor, '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 labelcompose/label.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
Label: Label + recipe label. Props (p): Class, Attrs + the props of Label. -#}
{%- with p = compose_props('Label', p) %}{% include 'ui/label/label.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.
Label renders a native label element.
No props.