Newer
Older
gnexus-ui-kit / src / vue / components / GnIconButton.js
@Eugene Sukhodolskiy Eugene Sukhodolskiy 14 hours ago 573 bytes Add Vue adapter foundation
import { defineComponent, h } from "vue";
import { cx, iconNode } from "../utils.js";

export default defineComponent({
	name: "GnIconButton",
	props: {
		icon: { type: String, required: true },
		label: { type: String, required: true },
		type: { type: String, default: "button" },
		withoutHover: { type: Boolean, default: false }
	},
	setup(props, { attrs }) {
		return () => h("button", {
			...attrs,
			type: props.type,
			"aria-label": props.label,
			class: cx("btn-icon", { "without-hover": props.withoutHover }, attrs.class)
		}, [iconNode(props.icon)]);
	}
});