import * as tabs from '@zag-js/tabs' import { normalizeProps, useMachine } from '@zag-js/solid' import { For, createMemo, createUniqueId } from 'solid-js' import type { JSX } from 'solid-js' export interface TabItem { value: string label: string content: JSX.Element } interface Props { tabs: TabItem[] initValue?: string sticky?: boolean tabClass?: string } export const Tabs = (props: Props) => { const [state, send] = useMachine(tabs.machine({ id: createUniqueId(), value: props.initValue ?? props.tabs[0].value })) const api = createMemo(() => tabs.connect(state, send, normalizeProps)) return (
{item => ( )}
{item => (
{item.content}
)}
) }