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

Xet Storage Details

Size:
979 Bytes
·
Xet hash:
ee46aa01f032eaf984f4006105c3353d0708147e47e0ff203a1ac8b43a0dde10

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