@thi.ng/rdom-components
Version:
Collection of unstyled, customizable components for @thi.ng/rdom
19 lines (18 loc) • 462 B
JavaScript
import { button } from "@thi.ng/hiccup-html/forms";
import { i } from "@thi.ng/hiccup-html/inline";
const iconButton = (opts) => {
const isLeft = opts.iconPos !== "right";
const icon = i(
{
style: {
fill: "currentColor",
[`margin-${isLeft ? "right" : "left"}`]: "0.5rem"
}
},
opts.icon
);
return isLeft ? button(opts.attribs, icon, opts.label) : button(opts.attribs, opts.label, icon);
};
export {
iconButton
};