1interface IButtonProps {2 className?: string;3 flat?: boolean;4 outline?: boolean;5 styles?: React.CSSProperties;6 variant?: 'primary' | 'secondary' | 'default';7 icon?: string;8 children?: React.ReactNode;9}1011export type ButtonProps = IButtonProps & JSX.IntrinsicElements['button'];
Make flat
Make outline (only for primary and secondary variants)
1import { Button } from 'neutrino-ui';23<Button type="button" onClick={console.log}>4 Default button5</Button>
1import { Button } from 'neutrino-ui';23<Button type="button" onClick={console.log} variant="primary" flat={true} outline={true}>4 Primary button5</Button>
1import { Button } from 'neutrino-ui';23<Button type="button" onClick={console.log} variant="secondary">4 Secondary button5</Button>
1import { Button } from 'neutrino-ui';2import CheckIcon from './CheckIcon';34<Button type="button" onClick={console.log} variant="primary">5 <CheckIcon /> Primary button6</Button>
1import React from 'react';2import { ThemeProvider } from 'emotion-theming';3import { Button, createTheme, ITheme } from 'neutrino-ui';45const theme: ITheme = {6colors: {7 mainColors: {8 primary: '#34B334',9 primaryDark: '#144D14',10 },11 },12 globals: {13 borderRadius: '32px'14 }15};1617const myTheme = createTheme(theme);1819<ThemeProvider theme={myTheme}>20 <Button21 type="button"22 onClick={console.log}23 variant="primary"24 css={{width: '250px'}}>25 Themed Primary button26 </Button>27</ThemeProvider>
1<Button2 type="button"3 onClick={console.log}4 variant="secondary"5 css={{ borderRadius: '100%', minWidth: '48px', width: '48px', height: '48px' }}>6 <CheckIcon />7</Button>
1function CustomCheckedButton() {2 const [isHovered, setHover] = React.useState(false);34 return <Button5 onClick={console.log}6 variant="primary"7 outline8 flat9 onMouseEnter={() => setHover(true)}10 onMouseLeave={() => setHover(false)}>11 <CheckIcon12 stroke={isHovered ? 'white' : myTheme.colors.mainColors.primary} />13 <span css={{marginLeft: '5px'}}>Custom Button</span>14 </Button>15}161718function App() {19 return <CustomCheckedButton {...someProps} />20}