Skip to content

AmandaSrisourath/basic-react-dropdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

basic-react-dropdown

npm basic-react-dropdown

Installation

npm install basic-react-dropdown

Usage

import React, { useState } from "react";
import Dropdown from "basic-react-dropdown";

function Form() {
    const [department, setDepartment] = useState('');
    
    const onEditDepartment = (value) => {
        setDepartment(value);
    }

    const departmentOptions = [
        { value: 'Sales', label: 'Sales' },
        { value: 'Marketing', label: 'Marketing' },
        { value: 'Engineering', label: 'Engineering' },
        { value: 'Human Resources', label: 'Human Resources' },
        { value: 'Legal', label: 'Legal' },
    ];
    
    return (
        <Dropdown options={departmentOptions} onChange={onEditDepartment} value={department}/>
    )
}

export default Form;

API

Props

Name Type Description
options array Array of object with value and label as property
onChange function Launch function when user select value
value string Display value of selected option

Development

npm run start
npm run test

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published