app: Initial tabs impl (#28436)

This commit is contained in:
Brendan Allan
2026-05-20 14:40:06 +08:00
committed by GitHub
parent 4702cddb3e
commit 38b406fb35
86 changed files with 10786 additions and 604 deletions
@@ -0,0 +1,28 @@
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>
)
}