components/tabs-content.svelte

bits-ui · packages/bits-ui/src/lib/bits/tabs/components/tabs-content.svelte · svelte · MIT
ui

A headless Svelte component that manages the visibility and accessibility attributes of a tab's content area.

<!--
  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 type { TabsContentProps } from "../types.js";
	import { TabsContentState } from "../tabs.svelte.js";
	import { createId } from "#lib/internal/create-id.js";

	const uid = $props.id();

	let {
		children,
		child,
		id = createId(uid),
		ref = $bindable(null),
		value,
		tabindex = 0,
		...restProps
	}: TabsContentProps = $props();

	const contentState = TabsContentState.create({
		value: boxWith(() => value),
		tabindex: boxWith(() => tabindex ?? 0),
		id: boxWith(() => id),
		ref: boxWith(
			() => ref,
			(v) =

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

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

Get a free API key