tutu/src/material/Button.tsx

26 lines
642 B
TypeScript
Raw Normal View History

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