Skip to content
ui8kit

primitive / primitives

Separator

Separator primitive

Install

npx ui8kit add separator

Pulls in: kit-separator, recipes, utils

Preview

orientation: horizontal

orientation: vertical

variant: default

variant: spaced

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-cdn
npx ui8kit add separator
compose/Separator.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Separator: Separator + recipe separator. -->
<script lang="ts">
  import type { ComponentProps, Snippet } from "svelte";
  import Prim from "../kit/ui/separator/Separator.svelte";
  import { cn } from "../kit/utils";
  import { rc } from "./recipes";

  let { "orientation": v_orientation, "variant": v_variant, class: className, children, ...rest }: ComponentProps<typeof Prim> & { "orientation"?: string | number; "variant"?: string | number; class?: string; children?: Snippet } = $props();
  const cls = $derived(cn(rc("separator", { "orientation": v_orientation, "variant": v_variant }), className));
</script>

<Prim class={cls} {...rest} />

Svelte registry item (JSON)

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-cdn
npx ui8kit add separator
compose/separator.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Separator as Prim } from "../kit/ui/separator/separator";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SeparatorProps = Omit<ComponentProps<typeof Prim>, "tag" | "orientation" | "variant"> & { "orientation"?: string | number; "variant"?: string | number; className?: string };

/** Separator: Separator + recipe separator. */
export function Separator({ "orientation": v_orientation, "variant": v_variant, className, ...rest }: SeparatorProps) {
  return <Prim className={cn(rc("separator", { "orientation": v_orientation, "variant": v_variant }), className)} {...rest} />;
}

React registry item (JSON)

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-cdn
npx ui8kit add separator
compose/Separator.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Separator: Separator + recipe separator. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/separator/Separator.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

defineOptions({ name: "Separator", inheritAttrs: false });
const props = defineProps<{ "orientation"?: string | number; "variant"?: string | number }>();
const attrs = useAttrs();
const rest = computed(() => {
  const { class: _class, ...r } = attrs;
  return r;
});
const cls = computed(() => cn(rc("separator", { "orientation": props["orientation"], "variant": props["variant"] }), attrs.class as string | undefined));
const tagValue = computed(() => "");
</script>

<template>
  <Prim :class="cls" v-bind="rest" />
</template>

Vue registry item (JSON)

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-cdn
npx ui8kit add separator
compose/separator.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 { Separator as Prim } from "../kit/ui/separator/separator.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SeparatorProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className" | "orientation" | "variant"> & { "orientation"?: string | number; "variant"?: string | number; class?: string; className?: string };

/** Separator: Separator + recipe separator. */
export function Separator(props: SeparatorProps) {
  const [local, rest] = splitProps(props, ["orientation", "variant", "class", "className"]);
  return <Prim class={cn(rc("separator", { "orientation": local["orientation"], "variant": local["variant"] }), local.class ?? local.className)} {...rest} />;
}

Solid registry item (JSON)

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-cdn
npx ui8kit add separator
compose/separator.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/separator"

// SeparatorProps: Separator: Separator + recipe separator.
type SeparatorProps struct {
	Orientation string
	Variant string
	separator.SeparatorProps
}

func separatorInner(p SeparatorProps) separator.SeparatorProps {
	in := p.SeparatorProps
	in.Class = Join(Rc("separator", map[string]string{"orientation": p.Orientation, "variant": p.Variant}), p.SeparatorProps.Class)
	return in
}

// Separator renders Separator with the composition classes.
templ Separator(p SeparatorProps) {
	@separator.Separator(separatorInner(p))
}

templ registry item (JSON)

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-cdn
npx ui8kit add separator
compose/Separator.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Separator: Separator + recipe separator. Params: orientation, variant, class, attrs + the params of Separator. #}
{% include 'ui/separator/Separator.html.twig' with compose_props('Separator', _context) only %}

Twig registry item (JSON)

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-cdn
npx ui8kit add separator
compose/Separator.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Separator: Separator + recipe separator. *}
{parameters
  string $class = '',
  bool $decorative = false,
  array $attrs = [],
  $orientation = null,
  $variant = null,
}
{include '../ui/separator/Separator.latte', ...[...\CodegenX\Compose\Latte\Compose::props('Separator', ['class' => $class, 'decorative' => $decorative, 'attrs' => $attrs, 'orientation' => $orientation, 'variant' => $variant]), 'orientation' => '']}

Latte registry item (JSON)

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-cdn
npx ui8kit add separator
compose/separator.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
    Separator: Separator + recipe separator. Props (p): Orientation, Variant, Class, Attrs + the props of Separator. -#}
{%- with p = compose_props('Separator', p) %}{% include 'ui/separator/separator.html.j2' %}{% endwith %}

Jinja2 registry item (JSON)

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.

Separator renders a void hr; no children.

Props of Separator
PropTypeDefault Description
orientation string-horizontal (default) | vertical
decorative boolean-purely visual: role=none, no separator semantics