Skip to content
ui8kit

primitive / primitives

Sheet Close

Sheet Close primitive

Install

npx ui8kit add sheet-close

Pulls in: kit-button, kit-icon, recipes, utils

Preview

default

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-close
compose/SheetClose.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SheetClose: Button + Lucide icons (data-ui8kit="sheet-close" behaviour). -->
<script lang="ts">
  import type { ComponentProps } from "svelte";
  import Prim from "../kit/ui/button/Button.svelte";
  import Icon from "../kit/ui/icon/Icon.svelte";
  import { cn } from "../kit/utils";
  import { rc } from "./recipes";

  let { variant, size, "aria-label": ariaLabel, class: className, ...rest }: Omit<ComponentProps<typeof Prim>, "children"> & { variant?: string; size?: string; "aria-label"?: string; class?: string } = $props();
</script>

<Prim type="button" class={cn(rc("sheettrigger", { variant, size }), className)} data-ui8kit="sheet-close" aria-label={ariaLabel || "Close menu"} {...rest}><Icon class="size-5"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></Icon></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-close
compose/sheet-close.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { Button as Prim } from "../kit/ui/button/button";
import { Icon } from "../kit/ui/icon/icon";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SheetCloseProps = Omit<ComponentProps<typeof Prim>, "children"> & { variant?: string; size?: string; "aria-label"?: string; className?: string };

/** SheetClose: Button + Lucide icons (data-ui8kit="sheet-close" behaviour). */
export function SheetClose({ variant, size, "aria-label": ariaLabel, className, ...rest }: SheetCloseProps) {
  return (
    <Prim type="button" className={cn(rc("sheettrigger", { variant, size }), className)} data-ui8kit="sheet-close" aria-label={ariaLabel || "Close menu"} {...rest}>
      <Icon className="size-5"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></Icon>
    </Prim>
  );
}

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-close
compose/SheetClose.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SheetClose: Button + Lucide icons (data-ui8kit="sheet-close" behaviour). -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/button/Button.vue";
import Icon from "../kit/ui/icon/Icon.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

defineOptions({ name: "SheetClose", inheritAttrs: false });
const props = defineProps<{ variant?: string; size?: string; ariaLabel?: string }>();
const attrs = useAttrs();
const rest = computed(() => {
  const { class: _class, ...r } = attrs;
  return r;
});
const cls = computed(() => cn(rc("sheettrigger", { variant: props.variant, size: props.size }), attrs.class as string | undefined));
</script>

<template>
  <Prim type="button" :class="cls" data-ui8kit="sheet-close" :aria-label="props.ariaLabel || 'Close menu'" v-bind="rest"><Icon class="size-5"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></Icon></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-close
compose/sheet-close.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 { Button as Prim } from "../kit/ui/button/button.solid";
import { Icon } from "../kit/ui/icon/icon.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SheetCloseProps = Omit<ComponentProps<typeof Prim>, "children" | "class" | "className"> & { variant?: string; size?: string; "aria-label"?: string; class?: string; className?: string };

/** SheetClose: Button + Lucide icons (data-ui8kit="sheet-close" behaviour). */
export function SheetClose(props: SheetCloseProps) {
  const [local, rest] = splitProps(props, ["variant", "size", "aria-label", "class", "className"]);
  return (
    <Prim type="button" class={cn(rc("sheettrigger", { variant: local.variant, size: local.size }), local.class ?? local.className)} data-ui8kit="sheet-close" aria-label={local["aria-label"] || "Close menu"} {...rest}>
      <Icon class="size-5"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></Icon>
    </Prim>
  );
}

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-close
compose/sheet-close.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/button"
	"github.com/ui8kit/codegen/generated/templ/ui/icon"
)

// SheetCloseProps: Button + Lucide icons (data-ui8kit="sheet-close").
type SheetCloseProps struct {
	Variant   string
	Size      string
	AriaLabel string
	button.ButtonProps
}

func sheetCloseInner(p SheetCloseProps) button.ButtonProps {
	in := p.ButtonProps
	in.Type = "button"
	in.Class = Join(Rc("sheettrigger", map[string]string{"variant": p.Variant, "size": p.Size}), p.ButtonProps.Class)
	fixed := map[string]string{"data-ui8kit": "sheet-close", "aria-label": Or(p.AriaLabel, "Close menu")}
	in.Attrs = WithAttrs(in.Attrs, fixed)
	return in
}

// SheetClose renders the button with its Lucide icons.
templ SheetClose(p SheetCloseProps) {
	@button.Button(sheetCloseInner(p)) {
		@icon.Icon(icon.IconProps{Class: "size-5"}) {
			@templ.Raw(lucideX)
		}
	}
}

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-close
compose/SheetClose.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# SheetClose: Button + Lucide icons. Params: variant, size, ariaLabel, class, attrs. #}
{% set a = {'data-ui8kit': 'sheet-close', 'aria-label': ariaLabel|default('') ?: 'Close menu'}|merge(attrs|default({})) %}
{% set icons %}{{ include('ui/icon/Icon.html.twig', {class: 'size-5', children: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>'}, with_context = false)|trim|raw }}{% endset %}
{{ include('ui/button/Button.html.twig', {type: 'button', class: compose_join([compose_rc('sheettrigger', {variant: variant|default(''), size: size|default('')}), class|default('')]), attrs: a, children: icons}, with_context = false)|trim|raw }}

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-close
compose/SheetClose.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* SheetClose: Button + Lucide icons. Includes inherit variables: every primitive param this template shadows is passed explicitly. *}
{parameters
  $variant = null,
  $size = null,
  string $controls = '',
  string $ariaLabel = '',
  string $class = '',
  array $attrs = [],
}
{var $a = ['data-ui8kit' => 'sheet-close', 'aria-label' => $ariaLabel !== '' ? $ariaLabel : 'Close menu', ...(false && $controls !== '' ? ['aria-controls' => $controls] : []), ...$attrs]}
{capture $icons}{include '../ui/icon/Icon.latte', size: '', label: '', class: 'size-5', attrs: [], children: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>'}{/capture}
{include '../ui/button/Button.latte', type: 'button', ariaLabel: null, ariaControls: null, class: \CodegenX\Compose\Latte\Compose::join([\CodegenX\Compose\Latte\Compose::rc('sheettrigger', ['variant' => $variant, 'size' => $size]), $class]), attrs: $a, children: (string) $icons}

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-close
compose/sheet-close.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
    SheetClose: Button + Lucide icons. Props (p): Variant, Size, AriaLabel, Class, Attrs. -#}
{%- set a = {'data-ui8kit': 'sheet-close', 'aria-label': p['AriaLabel'] or 'Close menu'} %}
{%- set _ = a.update(p['Attrs'] or {}) %}
{%- set icons %}{% with p = {'Class': 'size-5'}, children = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>'|safe %}{% include 'ui/icon/icon.html.j2' %}{% endwith %}{% endset %}
{%- with p = {'Type': 'button', 'Class': compose_join([compose_rc('sheettrigger', {'variant': p['Variant'], 'size': p['Size']}), p['Class']]), 'Attrs': a}, children = icons %}{% include 'ui/button/button.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.