(props: CheckboxProps)
| 9 | } |
| 10 | |
| 11 | export function Checkbox(props: CheckboxProps) { |
| 12 | const [local, others] = splitProps(props, ["children", "class", "label", "hideLabel", "description", "icon"]) |
| 13 | const resolved = children(() => local.children) |
| 14 | return ( |
| 15 | <Kobalte {...others} data-component="checkbox"> |
| 16 | <Kobalte.Input data-slot="checkbox-checkbox-input" /> |
| 17 | <Kobalte.Control data-slot="checkbox-checkbox-control"> |
| 18 | <Kobalte.Indicator data-slot="checkbox-checkbox-indicator"> |
| 19 | {local.icon || ( |
| 20 | <svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 21 | <path |
| 22 | d="M3 7.17905L5.02703 8.85135L9 3.5" |
| 23 | stroke="currentColor" |
| 24 | stroke-width="1.5" |
| 25 | stroke-linecap="square" |
| 26 | /> |
| 27 | </svg> |
| 28 | )} |
| 29 | </Kobalte.Indicator> |
| 30 | </Kobalte.Control> |
| 31 | <div data-slot="checkbox-checkbox-content"> |
| 32 | <Show when={resolved()}> |
| 33 | <Kobalte.Label data-slot="checkbox-checkbox-label" classList={{ "sr-only": local.hideLabel }}> |
| 34 | {resolved()} |
| 35 | </Kobalte.Label> |
| 36 | </Show> |
| 37 | <Show when={local.description}> |
| 38 | <Kobalte.Description data-slot="checkbox-checkbox-description">{local.description}</Kobalte.Description> |
| 39 | </Show> |
| 40 | <Kobalte.ErrorMessage data-slot="checkbox-checkbox-error" /> |
| 41 | </div> |
| 42 | </Kobalte> |
| 43 | ) |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected