@itwin/frontend-devtools
Version:
Debug menu and supporting UI widgets
23 lines • 1 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** Creates a Button as specified by the ButtonProps.
* @alpha
*/
export function createButton(props) {
const div = document.createElement(props.inline ? "span" : "div");
const button = document.createElement("input");
button.type = "button";
button.value = props.value;
button.addEventListener("click", () => props.handler(button));
div.appendChild(button);
if (undefined !== props.id)
button.id = props.id;
if (undefined !== props.tooltip)
div.title = props.tooltip;
if (undefined !== props.parent)
props.parent.appendChild(div);
return { button, div };
}
//# sourceMappingURL=Button.js.map