Range
Range primitive
Install
npx ui8kit add rangePulls in: kit-input, 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 rangecompose/Range.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Range: Input + recipe range. -->
<script lang="ts">
import type { ComponentProps, Snippet } from "svelte";
import Prim from "../kit/ui/input/Input.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("range", { }), className));
</script>
<Prim class={cls} type="range" {...rest} />
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 rangecompose/range.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Input as Prim } from "../kit/ui/input/input";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type RangeProps = Omit<ComponentProps<typeof Prim>, "tag"> & { className?: string };
/** Range: Input + recipe range. */
export function Range({ className, ...rest }: RangeProps) {
return <Prim className={cn(rc("range", { }), className)} type="range" {...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 rangecompose/Range.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Range: Input + recipe range. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/input/Input.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
defineOptions({ name: "Range", inheritAttrs: false });
const props = defineProps<{ }>();
const attrs = useAttrs();
const rest = computed(() => {
const { class: _class, ...r } = attrs;
return r;
});
const cls = computed(() => cn(rc("range", { }), attrs.class as string | undefined));
const tagValue = computed(() => "");
</script>
<template>
<Prim :class="cls" type="range" v-bind="rest" />
</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 rangecompose/range.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 { Input as Prim } from "../kit/ui/input/input.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";
export type RangeProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className"> & { class?: string; className?: string };
/** Range: Input + recipe range. */
export function Range(props: RangeProps) {
const [local, rest] = splitProps(props, ["class", "className"]);
return <Prim class={cn(rc("range", { }), local.class ?? local.className)} type="range" {...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 rangecompose/range.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/input"
// RangeProps: Range: Input + recipe range.
type RangeProps struct {
input.InputProps
}
func rangeInner(p RangeProps) input.InputProps {
in := p.InputProps
in.Class = Join(Rc("range", map[string]string{}), p.InputProps.Class)
in.Type = Or(in.Type, "range")
return in
}
// Range renders Input with the composition classes.
templ Range(p RangeProps) {
@input.Input(rangeInner(p))
}
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 rangecompose/Range.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Range: Input + recipe range. Params: class, attrs + the params of Input. #}
{% include 'ui/input/Input.html.twig' with compose_props('Range', _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 rangecompose/Range.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Range: Input + recipe range. *}
{parameters
string $class = '',
string $type = '',
?string $id = null,
?string $name = null,
?string $value = null,
?string $placeholder = null,
?string $min = null,
?string $max = null,
?string $step = null,
bool $required = false,
bool $disabled = false,
bool $readOnly = false,
?string $ariaInvalid = null,
?string $ariaDescribedBy = null,
array $attrs = [],
}
{include '../ui/input/Input.latte', ...\CodegenX\Compose\Latte\Compose::props('Range', ['class' => $class, 'type' => $type, 'id' => $id, 'name' => $name, 'value' => $value, 'placeholder' => $placeholder, 'min' => $min, 'max' => $max, 'step' => $step, 'required' => $required, 'disabled' => $disabled, 'readOnly' => $readOnly, 'ariaInvalid' => $ariaInvalid, 'ariaDescribedBy' => $ariaDescribedBy, 'attrs' => $attrs])}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 rangecompose/range.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
Range: Input + recipe range. Props (p): Class, Attrs + the props of Input. -#}
{%- with p = compose_props('Range', p) %}{% include 'ui/input/input.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.