react-button ============ > A carefully crafted button for React ## Install ```sh $ npm install react-button --save ``` ## Changelog See [Changelog](./CHANGELOG.md) ## Usage ```jsx var Button = require('react-button') function clicked(event){} ``` `react-button` does not depend on any css files. All styles are inline in the react component. `react-button` can also be used as a toggle button ```jsx var pressed = true function toggle(){ pressed = !pressed //now re-render } //controlled behavior ``` #### Style props Style props are applied in this order: * style - default style * disabledStyle - style to be applied when the button is disabled. If disabled, no other over/active/pressed styles are applied. * focusedStyle - style to be applied to focused button * pressedStyle * focusedPressedStyle * overStyle * overFocusedStyle * overPressedStyle * overFocusedPressedStyle * activeStyle - style to be applied on active button (mousedown over button) * activeFocusedStyle * activePressedStyle * activeFocusedPressedStyle You can set all these props both on the theme object, or on the button itself. ### Styling with CSS classes * overClassName: String - a css class to be applied when the mouse is over the button * activeClassName: String - a css class to be applied when the mouse is pressed on the button (the button is in active state) * focusedClassName: String - a css class to be applied when the button is focused * disabledClassName: String - a css class to be applied when the button is disabled * pressedClassName: String - a css class to be applied when the button is pressed ### Other attributes * disabled: Boolean * pressed: Boolean * defaultPressed: Boolean * label - (generally a string) you can specify a label instead of button children. If you specify the label, by default it will be rendered with text-overflow: 'ellipsis' * href: String - a href to navigate to when the button is clicked. Defaults to '' * align: String - where to align content inside button. Valid values are 'left', 'center', 'right' * 'block': Boolean - by default buttons are rendered with display `inline-flex`. Specify `block: true` if you want to use `display: flex` (or use style.display: 'flex'). * onStyleReady: Function - called after the style object is fully constructed * onThemeStyleReady: Function - called after the theme styles have been applied to the style object (before `onStyleReady`) ## Contributing ```sh $ npm install $ npm run dev # to start webpack-dev-server $ npm run serve # to start http-server on port 9091 ``` now navigate to [localhost:9091](http://localhost:9091) ## License #### MIT