@magicbell/magicbell-react
Version:
React components for building a notification inbox for your app
16 lines • 612 B
JavaScript
import React from 'react';
/**
* Toggle input.
*
* @example
* <ToggleInput label="Enable notifications" value={false} onClick={toggleNotifications} />
*/
export default function ToggleInput({ id, label, value = false, onClick }) {
const handleClick = () => {
onClick(!value);
};
return (React.createElement("div", null,
label ? (React.createElement("label", { htmlFor: id, style: { marginRight: '14px' } }, label)) : null,
React.createElement("input", { id: id, type: "checkbox", onClick: handleClick, defaultChecked: value })));
}
//# sourceMappingURL=ToggleInput.js.map