1.0.0 • Published 6 years ago

@softhem.se/select v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Table

A React Select Component.

Install

You can get it on npm.

npm install @softhem.se/select --save

Usage

import React from 'react';
import './components/select.css';
import Select from './components/Select';

function App() {
    return (
        <div className="App">
            <section className="dashboard" id="dashboard">
                <div className="dashboard--center">
                    <div className="row">
                        <div className="col-1-of-1">
                            <Select/>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    );
}

export default App;

Props

* The data show a list of options
* The callback function is called when an item is selected
Select.defaultProps = {
    data : [
        {
            value: 'pop',
            label: 'Pop'
        },
        {
            value: 'jazz',
            label: 'Jazz'
        },
        {
            value: 'rock',
            label: 'Rock'
        },
        {
            value: 'disco',
            label: 'Disco'
        },
    ],
    onSelect: (item) => console.log('You selected item ', item)
};

Publish

Prepare

npm run publish:prep

Publish to npm (after login)

npm run publish:npm

License

MIT License © Hazrat Ali