Giter Club home page Giter Club logo

react-opium-select's Introduction

react-opium-select

A simple select dropdown with a better UI.

Demo

Installation

npm i react-opium-select

Usage

Basic example

import React, { Component } from 'react';
import Select from 'react-opium-select';

class App extends Component {
  handleChange(value) {
    console.log(`Selected value: ${value}`);
  }

  render() {
    const options = [
      { label: 'Amritsar', value: 'amritsar' },
      { label: 'Bathinda', value: 'bathinda' },
      { label: 'Chandigarh', value: 'chandigarh' },
      { label: 'Ludhiana', value: 'ludhiana' },
      { label: 'Jalandhar', value: 'jalandhar' }
    ];

    return (
      <div style={{ margin: '200px auto', maxWidth: '200px' }}>

        <Select
          options={options}
          onChange={this.handleChange} />

      </div>
    );
  }
}

export default App;

Configuration

Props Type Default value Description
options Array - Select options passed as an array of objects. e.g. [{ label: 'Chandigarh', value: 'chandigarh' }, ...]
selectedValue String null Selected option
settings Array - UI settings - style, placeholder, maxItems, animateOnSelect, forceDirection
onChange Function undefined onChange handler

Settings

Props Type Default value Description
style Array - CSS styling options - padding, background, textColor, radius, borderWidth, borderColor
placeholder String - Placeholder for select dropdown
maxItems Number null Scroll items after this number
animateOnSelect Boolean true Subtle animation on item select
forceDirection String null Force open to a specified direction - up or down

Style

Props Type Default value Description
padding String 10px 15px CSS padding
background String #f1f2f3 Background color - solid or gradient.
textColor String #3A3A3D Text color, also used to compute scrollbar and hover colors, must be hex code.
radius Number 0 Border radius
borderWidth Number 0 Thikness of border
borderColor String #5D5E5F Border color

react-opium-select's People

Contributors

pb03 avatar thetutlage avatar

Stargazers

Omar Khatib avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.