New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-fancy-select

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fancy-select

react-fancy-select customizable react dropdown component

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

react-fancy-select

Travis npm package

So you want a styled select box?

Your designer has supplied you with a awesome looking select / dropdown list, not knowing that we still can't style native selects nicely.

Solution

With react-fancy-select, you're provided a custom implementation of a select / dropdown that you can style as much as you like.

Installation

npm i react-fancy-select
yarn add react-fancy-select

Usage

import React from "react";
import FancySelect from "react-fancy-select";
import "react-fancy-select/lib/react-fancy-select.css";

const items = [{
  id: 0,
  value: 'Apple',
  text: 'Apple',
}, {
  id: 1,
  value: 'Orange',
  text: 'Orange',
}, {
  id: 2,
  value: 'Pear',
  text: 'Pear',
}];

const Component = () => (
    <FancySelect
        items={items}
        onSelection={(item) => alert(`You selected ${item.text}`)}
    />
);

Props

PropertyTypeDefaultDescription
itemsarrayundefinedarray of items
onSelectionfunctionundefinedcallback fires upon item selection with selected object as parameter
useNativebooleantrueif true, positions and hides a select element on top of the component on mobile devices to trigger native select
placeholderstringPlease select...placeholder text to display before selection
namestringnullname to give to select element if being used in a form for requests
defaultValuestringnullthe default selected value

Styling

PropertyDescription
.FancySelect__Controlthe visible select component wrapper
.FancySelect__Listthe dropdown list
.FancySelect__ListItemthe dropdown list items
.FancySelect__ListItem:hoverthe dropdown list items on hover
.FancySelect__ListItem--focusedthe dropdown list items on focus (with keyboard arrows)

Todo

  • Write additional tests.
  • In-depth browser testing.

Keywords

react-component

FAQs

Package last updated on 08 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts