tutu/src/material/Button.tsx
2024-11-05 16:07:10 +08:00

25 lines
642 B
TypeScript

import { Component, JSX, splitProps } from "solid-js";
import materialStyles from "./material.module.css";
import "./typography.css";
/**
* Material-styled button.
*
* @param type Same as `<button>`'s type property, the default is 'button'
*/
const Button: Component<JSX.ButtonHTMLAttributes<HTMLButtonElement>> = (
props,
) => {
const [managed, passthough] = splitProps(props, ["class", "type"]);
const type = () => managed.type ?? "button";
return (
<button
type={type()}
class={`${materialStyles.button} buttonText ${managed.class || ""}`}
{...passthough}
></button>
);
};
export default Button;