Skip to content
ui8kit

primitive / primitives

Sheet Trigger

Sheet Trigger primitive

Install

npx ui8kit add sheet-trigger

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

Preview

variant: default
variant: ghost
variant: contrast
variant: current
size: sm
size: default
size: lg

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-trigger
compose/SheetTrigger.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SheetTrigger: Button + Lucide icons (data-ui8kit="sheet-trigger" 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, controls, "aria-label": ariaLabel, class: className, ...rest }: Omit<ComponentProps<typeof Prim>, "children"> & { variant?: string; size?: string; controls?: string; "aria-label"?: string; class?: string } = $props();
</script>

<Prim type="button" class={cn(rc("sheettrigger", { variant, size }), className)} data-ui8kit="sheet-trigger" aria-label={ariaLabel || "Open menu"} aria-expanded="false" aria-haspopup="dialog" aria-controls={controls || undefined} {...rest}><Icon class="block size-5 in-aria-expanded:hidden"><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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg></Icon><Icon class="hidden size-5 in-aria-expanded:block"><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-trigger
compose/sheet-trigger.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 SheetTriggerProps = Omit<ComponentProps<typeof Prim>, "children"> & { variant?: string; size?: string; controls?: string; "aria-label"?: string; className?: string };

/** SheetTrigger: Button + Lucide icons (data-ui8kit="sheet-trigger" behaviour). */
export function SheetTrigger({ variant, size, controls, "aria-label": ariaLabel, className, ...rest }: SheetTriggerProps) {
  return (
    <Prim type="button" className={cn(rc("sheettrigger", { variant, size }), className)} data-ui8kit="sheet-trigger" aria-label={ariaLabel || "Open menu"} aria-expanded="false" aria-haspopup="dialog" aria-controls={controls || undefined} {...rest}>
      <Icon className="block size-5 in-aria-expanded:hidden"><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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg></Icon><Icon className="hidden size-5 in-aria-expanded:block"><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-trigger
compose/SheetTrigger.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SheetTrigger: Button + Lucide icons (data-ui8kit="sheet-trigger" 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: "SheetTrigger", inheritAttrs: false });
const props = defineProps<{ variant?: string; size?: string; controls?: 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-trigger" :aria-label="props.ariaLabel || 'Open menu'" aria-expanded="false" aria-haspopup="dialog" :aria-controls="props.controls || undefined" v-bind="rest"><Icon class="block size-5 in-aria-expanded:hidden"><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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg></Icon><Icon class="hidden size-5 in-aria-expanded:block"><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-trigger
compose/sheet-trigger.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 SheetTriggerProps = Omit<ComponentProps<typeof Prim>, "children" | "class" | "className"> & { variant?: string; size?: string; controls?: string; "aria-label"?: string; class?: string; className?: string };

/** SheetTrigger: Button + Lucide icons (data-ui8kit="sheet-trigger" behaviour). */
export function SheetTrigger(props: SheetTriggerProps) {
  const [local, rest] = splitProps(props, ["variant", "size", "controls", "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-trigger" aria-label={local["aria-label"] || "Open menu"} aria-expanded="false" aria-haspopup="dialog" aria-controls={local.controls || undefined} {...rest}>
      <Icon class="block size-5 in-aria-expanded:hidden"><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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg></Icon><Icon class="hidden size-5 in-aria-expanded:block"><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-trigger
compose/sheet-trigger.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"
)

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

func sheetTriggerInner(p SheetTriggerProps) 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-trigger", "aria-expanded": "false", "aria-haspopup": "dialog", "aria-label": Or(p.AriaLabel, "Open menu")}
	if p.Controls != "" {
		fixed["aria-controls"] = p.Controls
	}
	in.Attrs = WithAttrs(in.Attrs, fixed)
	return in
}

// SheetTrigger renders the button with its Lucide icons.
templ SheetTrigger(p SheetTriggerProps) {
	@button.Button(sheetTriggerInner(p)) {
		@icon.Icon(icon.IconProps{Class: "block size-5 in-aria-expanded:hidden"}) {
			@templ.Raw(lucideMenu)
		}
		@icon.Icon(icon.IconProps{Class: "hidden size-5 in-aria-expanded:block"}) {
			@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-trigger
compose/SheetTrigger.html.twig
{# Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. #}
{# SheetTrigger: Button + Lucide icons. Params: variant, size, controls, ariaLabel, class, attrs. #}
{% set a = {'data-ui8kit': 'sheet-trigger', 'aria-expanded': 'false', 'aria-haspopup': 'dialog', 'aria-label': ariaLabel|default('') ?: 'Open menu'}|merge(controls|default('') ? {'aria-controls': controls} : {})|merge(attrs|default({})) %}
{% set icons %}{{ include('ui/icon/Icon.html.twig', {class: 'block size-5 in-aria-expanded:hidden', 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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg>'}, with_context = false)|trim|raw }}{{ include('ui/icon/Icon.html.twig', {class: 'hidden size-5 in-aria-expanded:block', 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-trigger
compose/SheetTrigger.latte
{* Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. *}
{* SheetTrigger: 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-trigger', 'aria-expanded' => 'false', 'aria-haspopup' => 'dialog', 'aria-label' => $ariaLabel !== '' ? $ariaLabel : 'Open menu', ...(true && $controls !== '' ? ['aria-controls' => $controls] : []), ...$attrs]}
{capture $icons}{include '../ui/icon/Icon.latte', size: '', label: '', class: 'block size-5 in-aria-expanded:hidden', 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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg>'}{include '../ui/icon/Icon.latte', size: '', label: '', class: 'hidden size-5 in-aria-expanded:block', 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-trigger
compose/sheet-trigger.html.j2
{#- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
    SheetTrigger: Button + Lucide icons. Props (p): Variant, Size, Controls, AriaLabel, Class, Attrs. -#}
{%- set a = {'data-ui8kit': 'sheet-trigger', 'aria-expanded': 'false', 'aria-haspopup': 'dialog', 'aria-label': p['AriaLabel'] or 'Open menu'} %}
{%- if p['Controls'] %}{%- set _ = a.update({'aria-controls': p['Controls']}) %}{%- endif %}
{%- set _ = a.update(p['Attrs'] or {}) %}
{%- set icons %}{% with p = {'Class': 'block size-5 in-aria-expanded:hidden'}, 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="M4 12h16"></path><path d="M4 6h16"></path><path d="M4 18h16"></path></svg>'|safe %}{% include 'ui/icon/icon.html.j2' %}{% endwith %}{% with p = {'Class': 'hidden size-5 in-aria-expanded:block'}, 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.