Meter
Meter primitive
Install
npx ui8kit add meterPulls in: kit-meter, 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 metercompose/Meter.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Meter: Meter + recipe meter. -->
<script lang="ts">
import type { ComponentProps, Snippet } from "svelte";
import Prim from "../kit/ui/meter/Meter.svelte";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
let { "size": v_size, "variant": v_variant, class: className, children, ...rest }: ComponentProps<typeof Prim> & { "size"?: string | number; "variant"?: string | number; class?: string; children?: Snippet } = $props();
const cls = $derived(cn(rc("meter", { "size": v_size, "variant": v_variant }), 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 metercompose/meter.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Meter as Prim } from "../kit/ui/meter/meter";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type MeterProps = Omit<ComponentProps<typeof Prim>, "tag" | "size" | "variant"> & { "size"?: string | number; "variant"?: string | number; className?: string };
/** Meter: Meter + recipe meter. */
export function Meter({ "size": v_size, "variant": v_variant, className, ...rest }: MeterProps) {
return <Prim className={cn(rc("meter", { "size": v_size, "variant": v_variant }), 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 metercompose/Meter.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Meter: Meter + recipe meter. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/meter/Meter.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
defineOptions({ name: "Meter", inheritAttrs: false });
const props = defineProps<{ "size"?: string | number; "variant"?: string | number }>();
const attrs = useAttrs();
const rest = computed(() => {
const { class: _class, ...r } = attrs;
return r;
});
const cls = computed(() => cn(rc("meter", { "size": props["size"], "variant": props["variant"] }), 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 metercompose/meter.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 { Meter as Prim } from "../kit/ui/meter/meter.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type MeterProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className" | "size" | "variant"> & { "size"?: string | number; "variant"?: string | number; class?: string; className?: string };
/** Meter: Meter + recipe meter. */
export function Meter(props: MeterProps) {
const [local, rest] = splitProps(props, ["size", "variant", "class", "className"]);
return <Prim class={cn(rc("meter", { "size": local["size"], "variant": local["variant"] }), 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 metercompose/meter.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/meter"
// MeterProps: Meter: Meter + recipe meter.
type MeterProps struct {
Size string
Variant string
meter.MeterProps
}
func meterInner(p MeterProps) meter.MeterProps {
in := p.MeterProps
in.Class = Join(Rc("meter", map[string]string{"size": p.Size, "variant": p.Variant}), p.MeterProps.Class)
return in
}
// Meter renders Meter with the composition classes.
templ Meter(p MeterProps) {
@meter.Meter(meterInner(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 metercompose/Meter.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Meter: Meter + recipe meter. Params: size, variant, class, attrs + the params of Meter. #}
{% include 'ui/meter/Meter.html.twig' with compose_props('Meter', _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 metercompose/Meter.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Meter: Meter + recipe meter. *}
{parameters
string $class = '',
?string $value = null,
?string $min = null,
?string $max = null,
?string $low = null,
?string $high = null,
?string $optimum = null,
?string $ariaLabel = null,
array $attrs = [],
string $children = '',
$size = null,
$variant = null,
}
{include '../ui/meter/Meter.latte', ...\CodegenX\Compose\Latte\Compose::props('Meter', ['class' => $class, 'value' => $value, 'min' => $min, 'max' => $max, 'low' => $low, 'high' => $high, 'optimum' => $optimum, 'ariaLabel' => $ariaLabel, 'attrs' => $attrs, 'children' => $children, 'size' => $size, 'variant' => $variant])}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 metercompose/meter.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
Meter: Meter + recipe meter. Props (p): Size, Variant, Class, Attrs + the props of Meter. -#}
{%- with p = compose_props('Meter', p) %}{% include 'ui/meter/meter.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.
Meter renders a native meter; children are the fallback text.
No props.