Skip to content
ui8kit

primitive / primitives

Sheet

Sheet primitive

Install

npx ui8kit add sheet

Pulls in: kit-dialog, recipes, utils

Preview

side: left
side: right

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

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

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

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

/** Sheet: Dialog + recipe sheet. */
export function Sheet({ "side": v_side, className, ...rest }: SheetProps) {
  return <Prim className={cn(rc("sheet", { "side": v_side }), 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 sheet
compose/Sheet.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- Sheet: Dialog + recipe sheet. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/dialog/Dialog.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

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

<template>
  <Prim :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 sheet
compose/sheet.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 { Dialog as Prim } from "../kit/ui/dialog/dialog.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

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

/** Sheet: Dialog + recipe sheet. */
export function Sheet(props: SheetProps) {
  const [local, rest] = splitProps(props, ["side", "class", "className"]);
  return <Prim class={cn(rc("sheet", { "side": local["side"] }), 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 sheet
compose/sheet.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/dialog"

// SheetProps: Sheet: Dialog + recipe sheet.
type SheetProps struct {
	Side string
	dialog.DialogProps
}

func sheetInner(p SheetProps) dialog.DialogProps {
	in := p.DialogProps
	in.Class = Join(Rc("sheet", map[string]string{"side": p.Side}), p.DialogProps.Class)
	return in
}

// Sheet renders Dialog with the composition classes.
templ Sheet(p SheetProps) {
	@dialog.Dialog(sheetInner(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 sheet
compose/Sheet.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# Sheet: Dialog + recipe sheet. Params: side, class, attrs + the params of Dialog. #}
{% include 'ui/dialog/Dialog.html.twig' with compose_props('Sheet', _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 sheet
compose/Sheet.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* Sheet: Dialog + recipe sheet. *}
{parameters
  string $class = '',
  ?string $id = null,
  bool $open = false,
  ?string $ariaLabelledBy = null,
  ?string $ariaDescribedBy = null,
  ?string $ariaLabel = null,
  array $attrs = [],
  string $children = '',
  $side = null,
}
{include '../ui/dialog/Dialog.latte', ...\CodegenX\Compose\Latte\Compose::props('Sheet', ['class' => $class, 'id' => $id, 'open' => $open, 'ariaLabelledBy' => $ariaLabelledBy, 'ariaDescribedBy' => $ariaDescribedBy, 'ariaLabel' => $ariaLabel, 'attrs' => $attrs, 'children' => $children, 'side' => $side])}

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 sheet
compose/sheet.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
    Sheet: Dialog + recipe sheet. Props (p): Side, Class, Attrs + the props of Dialog. -#}
{%- with p = compose_props('Sheet', p) %}{% include 'ui/dialog/dialog.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.