Files
FastUI/packages/fastui/src/components/button.tsx
Samuel Colvin e06fddf29e Bootstrap (#5)
2023-11-24 10:28:20 +00:00

25 lines
582 B
TypeScript

import { FC } from 'react'
import { ClassName, useClassName } from '../hooks/className'
import { useFireEvent, AnyEvent } from '../hooks/events'
export interface ButtonProps {
type: 'Button'
text: string
onClick?: AnyEvent
htmlType?: 'button' | 'submit' | 'reset'
className?: ClassName
}
export const ButtonComp: FC<ButtonProps> = (props) => {
const { text, onClick, htmlType } = props
const { fireEvent } = useFireEvent()
return (
<button className={useClassName(props)} type={htmlType} onClick={() => fireEvent(onClick)}>
{text}
</button>
)
}