0.1.1 • Published 5 years ago

@y2z/dropdown-components v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

DropDown Component

A react component to display components according to a value selected.

Installation

  yarn add @y2z/dropdown-components

Usage

  import DropDown from 'component-drop-down';
  import Selection from './Selection';

  class Example {

    render() {

      return (
        <DropDown
          style={{ width: '100%' }}
          data={[ { title: 'Selection', component: <Selection />}]}
          optionHeader="-- select sorting algorithm --"
          componentStyle={{}}
        />
      )
    }
  }

Parameters

  • style: style object for the select element
  • data: An array of object containing title (string ) and the component to render
  • optionHeader: the default option in a select if not provided will be empty
  • componentStyle: style object for the component container

Output