You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
713 B
JavaScript

import React from 'react'
import {Icon} from '@rmwc/icon'
import styles from './styles.module.css'
export default function Button({outline, onClick, enabled, type, children, icon: _icon, style}){
const icon = _icon && (typeof _icon === 'string' ? <Icon icon={_icon}/> : _icon)
return (
<div className={styles.formElementContainer + (outline ? ' ' + styles.outline : '')}>
<button style={style} className={icon && styles.buttonWithIcon} disabled={enabled === undefined ? false : !enabled} onClick={onClick} type={type}>
{icon && <span className={styles.buttonIcon}>{icon}</span>}
{children && <span className={styles.buttonText}>{children}</span>}
</button>
</div>
)
}