vdux-button
v1.0.1
Published
Button container component
Downloads
3
Readme
button
Button container component
Installation
$ npm install vdux-button
Usage
This component follows the container/presentational component pattern as outlined by Dan Abramov here. This is a container component, and it holds state around buttons (in this case, just hover
state), and orchestrates a few presentational components to generate a useful button abstraction.
Example:
import Button from 'vdux-button'
function render () {
return (
<Button tooltip="mystery button">
Click Me!
</Button>
)
}
Using different presenters
If you want to use a different presentational button, you can pass that in the ui
prop, e.g.
import {LogoButton} from 'vdux-ui'
function render () {
return (
<Button ui={LogoButton} tooltip='Login with Google' logo='images/google_plus.png'>
Google Login
</Button>
)
}
API - props
ui
- The presentational button component to use for rendering. Will receive all props not specifically destined somewhere else (e.g.tooltip
).ttUi
- The tooltip presenterhighlight
- Whether or not to highlight the button on hover. Defaults totrue
.hoverStyle
- Styles to add when the button is hovered. If enabled, overrides thetrue
default ofhighlight
.tooltip
- Tooltip message, shows up on hoverttPlacement
- Tooltip placement (e.g. top/right/bottom/left)ttSpace
- How far away the tooltip is from the button
License
MIT