@wq/material-web
Version:
Web bindings for @wq/material
23 lines (22 loc) • 634 B
JavaScript
import React from "react";
import { useIcon } from "@wq/react";
import { IconButton as MuiIconButton } from "@mui/material";
import PropTypes from "prop-types";
export default function IconButton({ icon, size = "large", ...rest }) {
const Icon = useIcon(icon);
if (!Icon) {
throw new Error(`"${icon}" is not a registered icon!`);
}
return /*#__PURE__*/ React.createElement(
MuiIconButton,
{
size: size,
...rest,
},
/*#__PURE__*/ React.createElement(Icon, null)
);
}
IconButton.propTypes = {
icon: PropTypes.string,
size: PropTypes.string,
};