Files
sigpro-ui/components/Collapse.js
natxocc d900659d88
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s
Migrating new components
2026-04-20 23:31:14 +02:00

21 lines
545 B
JavaScript

// components/Collapse.js
import { Tag } from "sigpro";
export const Collapse = (props, children) => {
const { class: className, open, ...rest } = props;
return Tag("div", {
...rest,
class: `collapse ${className || ''}`.trim(),
tabindex: 0
}, [
Tag("input", {
type: "checkbox",
checked: () => typeof open === "function" ? open() : open,
onchange: (e) => {
if (typeof open === "function") open(e.target.checked);
}
}),
...(Array.isArray(children) ? children : [children])
]);
};