MCPcopy Create free account
hub / github.com/TanStack/devtools / Checkbox

Function Checkbox

packages/devtools-ui/src/components/checkbox.tsx:11–43  ·  view source on GitHub ↗
(props: CheckboxProps)

Source from the content-addressed store, hash-verified

9}
10
11export function Checkbox(props: CheckboxProps) {
12 const styles = createStyles()
13 const [isChecked, setIsChecked] = createSignal(props.checked || false)
14 const descriptionId = `${createUniqueId()}-description`
15
16 const handleChange = (e: Event) => {
17 const checked = (e.target as HTMLInputElement).checked
18 setIsChecked(checked)
19 props.onChange?.(checked)
20 }
21
22 return (
23 <div class={styles().checkboxContainer}>
24 <label class={styles().checkboxWrapper}>
25 <input
26 data-tsd-control
27 data-tsd-selected={isChecked() ? 'true' : undefined}
28 aria-describedby={props.description ? descriptionId : undefined}
29 type="checkbox"
30 checked={props.checked ?? isChecked()}
31 class={styles().checkbox}
32 onInput={handleChange}
33 />
34 <div class={styles().checkboxLabelContainer}>
35 {props.label && (
36 <span class={styles().checkboxLabel}>{props.label}</span>
37 )}
38 {props.description && (
39 <span id={descriptionId} class={styles().checkboxDescription}>
40 {props.description}
41 </span>
42 )}
43 </div>
44 </label>
45 </div>
46 )

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected