0.0.7 • Published 8 years ago

@tgdn/react-dropdown v0.0.7

Weekly downloads
11
License
MIT
Repository
-
Last release
8 years ago

React Dropdown npm version

An accessible, easy to use, customizable dropdown library for the web.

Ongoing work on the library.

Playground

To run demo on your computer

Installing

npm install --save @tgdn/react-dropdown

Usage

import React from 'react'
import {
    Dropdown,
    DropdownMenu,
    DropdownMenuItem,
    DropdownButton
} from '@tgdn/react-dropdown'

const MyMenu = props => {
    return (
        <DropdownButton title='Click me' center>
            <DropdownMenu>
                <DropdownMenuItem>Click me</DropdownMenuItem>
				<DropdownMenuItem>Once more</DropdownMenuItem>
                <DropdownMenuItem>Log out</DropdownMenuItem>
            </DropdownMenu>
        </DropdownButton>
    )
}

Configuration

Different prop types are available for use on DropdownButton or directly on Dropdown

PropDefaultValueDescription
openedfalsetrue/falseWhether the dropdown should be visible after mounting
noArrowfalsetrue/falseIf true, no arrow will be displayed. The default is with an arrow, and thus false
arrowLeftfalsetrue/falseIf true, the arrow will be on the left of the dropdown, otherwise arrow stays untouched
arrowRightfalsetrue/falseIf true, the arrow will be on the right of the dropdown, otherwise arrow stays untouched
centerfalsetrue/falseWhether to align the dropdown and the button so they are horizontally aligned
pullLeftfalsetrue/falseIf true, the dropdown will be shifted all the way to the left
pullRightfalsetrue/falseIf true, the dropdown will be shifted all the way to the right
alignLeftfalsetrue/falseIf true, the dropdown will left side will be aligned with the container's left side
alignRightfalsetrue/falseIf true, the dropdown will right side will be aligned with the container's right side

Done

  • Simple UI
  • Reactive Component
  • Dropdown positioning
  • Arrow positioning
  • Dropdown Button and Menu

To do

  • Dynamic positioning on window scroll and window resize
  • More components (simple view, ...)