I would like to extend the default Material-UI button to add more variants such as "square."
How can I define the prop interface to inherit/combine props.
Here's my code:
import React from "react";
import { Button as MuiButton } from "@material-ui/core";
import { ButtonProps as MuiButtonProps } from "@material-ui/core/Button";
interface ButtonProps extends MuiButtonProps {
variant?: "square";
}
const defaultProps = {};
const Button: React.FC<ButtonProps> = ({variant, children, ...props}) => {
return (
<MuiButton variant={variant} {...props}>
{props.children}
</MuiButton>;
)
};
Button.defaultProps = defaultProps;
export default Button;
Ideally, I would like to use this component like so:
<ExtendedButton href="/" variant="square">Click Me!</ExtendedButton>