npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-select-pure

v0.0.3-alpha.0

Published

React wrapper for SelectPure component

Downloads

5

Readme

React wrapper for a custom JavaScript <select> component. Easy-to-use, accessible, mobile friendly and super efficient.

npm version npm Published on webcomponents.org

Description

SelectPure is a Web Component (Custom Element) which makes it super easy to use and customize. Main goal is to use extended API of the native HTML <select> element and provide additional features, like autocomplete, custom styling and many more. The package itself is stable to be used, however, if you've found any issues, please report them here or create a PR of your own.

Demo

Interactive demo with many examples is available here.

Usage

SelectPure is very easy to use. At first you have to install a package

yarn add react-select-pure

or

npm i react-select-pure --save

then include it in your JavaScript file:

import { SelectPure } from "react-select-pure";
<SelectPure
  name="country"
  id="country"
  options={[
    { value: "", disabled: true, hideen: true, label: "-- Please select a country --" },
    { value: "UA", label: "Ukrane" },
    { value: "PL", label: "Poland" },
    { value: "DE", label: "Germany" },
    { value: "US", label: "USA" },
    { value: "RU", label: "Russia", disabled: true }
  ]}
/>

Attributes

<select-pure> supports the following attributes: name, id, multiple, default-label and disabled.

<option-pure> supports value, label, disabled, selected and hidden attributes.

Custom styles

SelectPure offers high level of customisation. You can match any design you want by just providing a simple set of css variables. Below you can find their names and default values that are included in the package.

select-pure {
  --select-height: 44px;
  --select-width: 100%;
  --border-radius: 4px;
  --border-width: 1px;
  --border-color: #000;
  --padding: 0 10px;
  --dropdown-z-index: 2;
  --disabled-background-color: #bdc3c7;
  --disabled-color: #ecf0f1;
  --background-color: #fff;
  --color: #000;
  --hover-background-color: #e3e3e3;
  --hover-color: #000;
  --selected-background-color: #e3e3e3;
  --selected-color: #000;
  --dropdown-gap: 0;
  --font-size: 14px;
  --font-family: inherit;
  --font-weight: 400;
  --select-outline: 2px solid #e3e3e3;
  --dropdown-items: 4;
}

<form> support

If you place <SelectPure /> inside a <form> and specify a name or id props, it will then append a hidden input with a given name inside a <form> and trigger change event, when value is selected.

TODO

  • [ ] Multiple support
  • [ ] Default label support
  • [ ] Write tests
  • [ ] Callbacks
  • [ ] Methods

License

MIT