GHHG10's picture
download
raw
1.11 kB
import { Switch as Kobalte } from "@kobalte/core/switch"
import { Show, splitProps } from "solid-js"
import type { ComponentProps, ParentProps } from "solid-js"
export interface SwitchProps extends ParentProps<ComponentProps<typeof Kobalte>> {
hideLabel?: boolean
description?: string
}
export function Switch(props: SwitchProps) {
const [local, others] = splitProps(props, ["children", "class", "hideLabel", "description"])
return (
<Kobalte {...others} class={local.class} data-component="switch">
<Kobalte.Input data-slot="switch-input" />
<Show when={local.children}>
<Kobalte.Label data-slot="switch-label" classList={{ "sr-only": local.hideLabel }}>
{local.children}
</Kobalte.Label>
</Show>
<Show when={local.description}>
<Kobalte.Description data-slot="switch-description">{local.description}</Kobalte.Description>
</Show>
<Kobalte.ErrorMessage data-slot="switch-error" />
<Kobalte.Control data-slot="switch-control">
<Kobalte.Thumb data-slot="switch-thumb" />
</Kobalte.Control>
</Kobalte>
)
}

Xet Storage Details

Size:
1.11 kB
·
Xet hash:
afae81d9ad7bc4a6f4cc7a2ae118cbeaedd091e0658a1ab32f8f3465ba298f85

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.