Code Monkey home page Code Monkey logo

react-select-popover's Introduction

React Select Popover

A react component to convert a select box into a nifty popover with prepopulated options.

This creates a hidden multi select field. You can submit it as part of a form or listen for onChange event.

React Select Popover

Usage

The easiest way to use this is to install it via npm

npm install react-select-popover

Alternately, you can also use the CSS & Javascript files in the dist folder. Just make sure that you have included React separately and that it is available in the global scope. You'll also need to include react-onclickoutside.

Using this component is fairly easy,

var SelectPopover   = require("react-select-popover"),
    React           = require('react');


// These are the props that you can pass to the component
// options is a required prop, rest of them are optional
var options = [
    { label: "CSS", value: "css" },
    { label: "HTML", value: "html" },
    { label: "JavaScript", value: "js" },
    { label: "Ruby on Rails", value: "ror" },
];
var selectFieldName = "my-select";
var selectPlaceholder = "Choose some options...";
var onChange = function(obj) {
    console.log("EVENT", obj.event); // "added" or "removed"
    console.log("ITEM", obj.item);   // item that has been added/removed { label: '...', value: '...' }
    console.log("VALUE", obj.value); // [{label: '...', value: '...'}, {label: '...', value: '...'}]
}

React.render(
    <SelectPopover 
        options={options} 
        name={selectFieldName} 
        selectPlaceholder={selectPlaceholder}  
        onChange={ onChange }
    />,
    document.getElementById("root")
);

bharanim | Twitter


PS: I am new to React and this is my first attempt at making a component. Do let me know if I have made any mistakes.

react-select-popover's People

Contributors

bharani91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-select-popover's Issues

lib has React.findDOMNode

I am taking a look at your project and I am getting warnings saying that you are using the deprecated feature React.findDOMNode.

Searching through your code in src/scripts/components/select-input.jsx you use ReactDOM.findDOMNode but in lib/select-input.js it is using React.findDOMNode.

By default when I install via npm it uses what is in lib. Is there a reason what is in lib is different than what is in src?

cant find react dom in node modules

I am getting this error

./node_modules/react-select-popover/node_modules/react-dom/index.js
Module not found: Can't resolve 'react/lib/ReactDOM' in '/Users/ankursharma/Documents/projects/meetupz/client_src/node_modules/react-select-popover/node_modules/react-dom'

can you help me out?

default selections

Is there anyway to have a pre-selected options? I mean, if I have options O1, O2, .... On, then a subset of them could be shown as selected by the time your select control is loaded for the first time.

Onclickoutside does not work

Hi,

I installed react-select-popover and react-onclickoutside, but the popover doesn't hide when clicked outside.
What i'm I doing wrong ?
I build my project using gulp and browserify

Best
Younes

How do you clear selected values?

Hi, I'm currently using your plugin for my current project, I'm relatively new to react and I was wondering how would i reset selected values for select-popover/

Error with unmet peer deps

Hi,

There seems to be a problem with using this package with react 15.4.1. On install, I keep getting unmet peer dep error.

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.