@magicbell/magicbell-react
Version:
React components for building a notification inbox for your app
20 lines • 801 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ToggleInput;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
/**
* Toggle input.
*
* @example
* <ToggleInput label="Enable notifications" value={false} onClick={toggleNotifications} />
*/
function ToggleInput({ id, label, value = false, onClick }) {
const handleClick = () => {
onClick(!value);
};
return (react_1.default.createElement("div", null,
label ? (react_1.default.createElement("label", { htmlFor: id, style: { marginRight: '14px' } }, label)) : null,
react_1.default.createElement("input", { id: id, type: "checkbox", onClick: handleClick, defaultChecked: value })));
}
//# sourceMappingURL=ToggleInput.js.map