components/select-trigger.svelte

bits-ui · packages/bits-ui/src/lib/bits/select/components/select-trigger.svelte · svelte · MIT
ui

A headless select trigger that manages accessibility and state for opening selection menus in Svelte applications.

<!--
  Source: https://github.com/huntabyte/bits-ui | License: MIT | Copyright 2024 Hunter Johnston <https://github.com/huntabyte>
  Provided via justclaw.it.com; keep this notice with the code.
-->
<script lang="ts">
	import { boxWith, mergeProps } from "svelte-toolbelt";
	import { SelectTriggerState } from "../select.svelte.js";
	import type { SelectTriggerProps } from "../types.js";
	import { createId } from "#lib/internal/create-id.js";
	import { FloatingLayer } from "#lib/bits/utilities/floating-layer/index.js";

	const uid = $props.id();

	let {
		id = createId(uid),
		ref = $bindable(null),
		child,
		children,
		type = "button",
		...restProps
	}: SelectTriggerProps = $props();

	const triggerState = SelectTriggerState.create({
		id: boxWith(() => id),
		ref: boxWith(
			() => ref,

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key