|
|
@@ -1,5 +1,5 @@
|
|
|
import { Checkbox as Kobalte } from "@kobalte/core/checkbox"
|
|
|
-import { children, Show, splitProps } from "solid-js"
|
|
|
+import { Show, splitProps } from "solid-js"
|
|
|
import type { ComponentProps, JSX, ParentProps } from "solid-js"
|
|
|
|
|
|
export interface CheckboxProps extends ParentProps<ComponentProps<typeof Kobalte>> {
|
|
|
@@ -10,7 +10,6 @@ export interface CheckboxProps extends ParentProps<ComponentProps<typeof Kobalte
|
|
|
|
|
|
export function Checkbox(props: CheckboxProps) {
|
|
|
const [local, others] = splitProps(props, ["children", "class", "label", "hideLabel", "description", "icon"])
|
|
|
- const resolved = children(() => local.children)
|
|
|
return (
|
|
|
<Kobalte {...others} data-component="checkbox">
|
|
|
<Kobalte.Input data-slot="checkbox-checkbox-input" />
|
|
|
@@ -29,9 +28,9 @@ export function Checkbox(props: CheckboxProps) {
|
|
|
</Kobalte.Indicator>
|
|
|
</Kobalte.Control>
|
|
|
<div data-slot="checkbox-checkbox-content">
|
|
|
- <Show when={resolved()}>
|
|
|
+ <Show when={props.children}>
|
|
|
<Kobalte.Label data-slot="checkbox-checkbox-label" classList={{ "sr-only": local.hideLabel }}>
|
|
|
- {resolved()}
|
|
|
+ {props.children}
|
|
|
</Kobalte.Label>
|
|
|
</Show>
|
|
|
<Show when={local.description}>
|