Skip to content
ui8kit

primitive / primitives

Group

Group primitive

Install

npx ui8kit add group

Pulls in: kit-box, recipes, utils

Preview

gap: 0
gap: 2
gap: 4
gap: 6
gap: 8
gap: 10
gap: 12
gap: auto
align: start
align: center
align: end
align: stretch
align: baseline

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

  let { "gap": v_gap, "align": v_align, "justify": v_justify, tag, class: className, children, ...rest }: Omit<ComponentProps<typeof Prim>, "tag"> & { "gap"?: string | number; "align"?: string | number; "justify"?: string | number; tag?: string | number; class?: string; children?: Snippet } = $props();
  const cls = $derived(cn(rc("group", { "gap": v_gap, "align": v_align, "justify": v_justify }), className));
</script>

<Prim tag={(tag ?? "div") as never} class={cls} {...rest}>{@render children?.()}</Prim>

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

export type GroupProps = Omit<ComponentProps<typeof Prim>, "tag" | "gap" | "align" | "justify"> & { "gap"?: string | number; "align"?: string | number; "justify"?: string | number; tag?: string; className?: string };

/** Group: Box + recipe group. */
export function Group({ "gap": v_gap, "align": v_align, "justify": v_justify, tag, className, ...rest }: GroupProps) {
  return <Prim tag={(tag ?? "div") as never} className={cn(rc("group", { "gap": v_gap, "align": v_align, "justify": v_justify }), 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 group
compose/Group.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Group: Box + recipe group. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/box/Box.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

defineOptions({ name: "Group", inheritAttrs: false });
const props = defineProps<{ "gap"?: string | number; "align"?: string | number; "justify"?: string | number; tag?: string | number }>();
const attrs = useAttrs();
const rest = computed(() => {
  const { class: _class, ...r } = attrs;
  return r;
});
const cls = computed(() => cn(rc("group", { "gap": props["gap"], "align": props["align"], "justify": props["justify"] }), attrs.class as string | undefined));
const tagValue = computed(() => (props.tag ?? "div"));
</script>

<template>
  <Prim :tag="tagValue as never" :class="cls" v-bind="rest"><slot /></Prim>
</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 group
compose/group.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 { Box as Prim } from "../kit/ui/box/box.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type GroupProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className" | "gap" | "align" | "justify"> & { "gap"?: string | number; "align"?: string | number; "justify"?: string | number; tag?: string; class?: string; className?: string };

/** Group: Box + recipe group. */
export function Group(props: GroupProps) {
  const [local, rest] = splitProps(props, ["gap", "align", "justify", "tag", "class", "className"]);
  return <Prim tag={(local.tag ?? "div") as never} class={cn(rc("group", { "gap": local["gap"], "align": local["align"], "justify": local["justify"] }), 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 group
compose/group.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/box"

// GroupProps: Group: Box + recipe group.
type GroupProps struct {
	Gap string
	Align string
	Justify string
	box.BoxProps
}

func groupInner(p GroupProps) box.BoxProps {
	in := p.BoxProps
	in.Class = Join(Rc("group", map[string]string{"gap": p.Gap, "align": p.Align, "justify": p.Justify}), p.BoxProps.Class)
	in.Tag = Or(in.Tag, "div")
	return in
}

// Group renders Box with the composition classes.
templ Group(p GroupProps) {
	@box.Box(groupInner(p)) {
		{ children... }
	}
}

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 group
compose/Group.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Group: Box + recipe group. Params: gap, align, justify, tag, class, attrs + the params of Box. #}
{% include 'ui/box/Box.html.twig' with compose_props('Group', _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 group
compose/Group.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Group: Box + recipe group. *}
{parameters
  string $class = '',
  string $tag = '',
  array $attrs = [],
  string $children = '',
  $gap = null,
  $align = null,
  $justify = null,
}
{include '../ui/box/Box.latte', ...\CodegenX\Compose\Latte\Compose::props('Group', ['class' => $class, 'tag' => $tag, 'attrs' => $attrs, 'children' => $children, 'gap' => $gap, 'align' => $align, 'justify' => $justify])}

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 group
compose/group.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
    Group: Box + recipe group. Props (p): Gap, Align, Justify, Tag, Class, Attrs + the props of Box. -#}
{%- with p = compose_props('Group', p) %}{% include 'ui/box/box.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.

No props.