Add Swap component for toggle functionality

This commit is contained in:
Natxo
2026-03-31 12:17:05 +02:00
committed by GitHub
parent 62a3677187
commit bf3ee40641

13
src/components/Swap.js Normal file
View File

@@ -0,0 +1,13 @@
import { $html } from "sigpro";
import { joinClass } from "../core/utils.js";
/** SWAP */
export const Swap = (props) =>
$html("label", { class: joinClass("swap", props.class) }, [
$html("input", {
type: "checkbox",
checked: props.value
}),
$html("div", { class: "swap-on" }, props.on),
$html("div", { class: "swap-off" }, props.off),
]);