You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
379 B
TypeScript

import { h } from "preact";
import { useRef } from "preact/hooks";
import { Callback } from "../../../utils.ts";
export const Checkbox = (p: {
checked: boolean;
onToggle: Callback<[boolean]>;
}) => {
const ref = useRef<HTMLInputElement>(null);
return h("input", {
ref,
type: "checkbox",
checked: p.checked,
onChange: () => p.onToggle(ref.current!.checked),
});
};