Skip to content

PasinduS96/dynamic-dropdown

Repository files navigation

dynamic-dropdown

You can create dynamic dropdown by passing an array according to your requirements. This package will mostly fullfill many kind of dropdown menu component requirements when developing react apps.

NPM JavaScript Style Guide

Install

npm install --save dynamic-dropdown

Usage

import React from 'react'

import { DropDown } from 'dynamic-dropdown'
import 'dynamic-dropdown/dist/index.css'

const App = () => {
  const options = [
    { value: 'Spring', label: 'Spring' },
    { value: 'Summer', label: 'Summer' },
    { value: 'Autumn', label: 'Autumn' },
    { value: 'Winter', label: 'Winter' }
  ]

  const styles = {
    selection: { width: 300, borderRadius: 10 }, //Styles for dropdown menu
    div: {}, //Styles for div
    options: {} //Styles for dropdown selection option
  }

  return (
    <DropDown
      elements={options}
      selection={styles.selection}
      div={styles.div}
      options={styles.options}
    />
  )
}

export default App

License

MIT © PasinduS96