js-draw
Version:
Draw pictures using a pen, touchscreen, or mouse! JS-draw is a drawing library for JavaScript and TypeScript.
16 lines (15 loc) • 437 B
JavaScript
import createElement from './createElement.mjs';
const createButton = ({ onClick, text, classList = [] } = {}) => {
const button = createElement('button', { type: 'button' });
if (onClick) {
button.onclick = onClick;
}
if (text) {
button.textContent = text;
}
for (const className of classList) {
button.classList.add(className);
}
return button;
};
export default createButton;