17 lines
504 B
TypeScript
17 lines
504 B
TypeScript
import { ButtonHTMLAttributes, ReactNode } from "react";
|
|
import clsx from "clsx";
|
|
import styles from "./IconButton.module.css";
|
|
|
|
type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
children: ReactNode;
|
|
label: string;
|
|
};
|
|
|
|
export function IconButton({ children, className, label, type = "button", ...props }: IconButtonProps) {
|
|
return (
|
|
<button aria-label={label} className={clsx(styles.root, className)} title={label} type={type} {...props}>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|