vdux-dropdown
Stateful wrapper around vdux-ui's presentational Dropdown component
Last updated 5 years ago by ashaffer88 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vdux-dropdown 
SYNC missed versions from official npm registry.

dropdown

js-standard-style

Stateful wrapper around vdux-ui's presentational Dropdown and DropdownMenu components.

Installation

$ npm install vdux-dropdown

Usage

Use this to show menus when a button is clicked:

import Dropdown from 'vdux-dropdown'
import {Icon} from 'vdux-ui'

function OptionsMenu () {
  return (
    <Dropdown btn={<Icon name='settings' />}>
      <li onClick={changeUsername}>Change username</li>
      <li onClick={changePassword}>Change password</li>
    </Dropdown>
  )
}

API - props

  • btn - Function|VNode - The button that opens the dropdown. If it's a vnode, it will open on click. If it's a function, it will receive {toggle, close} and should return a vnode (and click handling must be setup manually if you want it).
  • right - Anchor the dropdown to the right side of its container
  • top - Align it with the top edge of the container
  • ref - If you need to access the API of the dropdown, you can specify this ref property as a function, and it will provide you with an object containing {toggle, close} functions so that you can call into the dropdown from outside if you need.

License

MIT

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (12)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |