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

cg-select

v0.3.3

Published

Feature rich Select control for React/JS with multiselect, autocomplete and styling

Downloads

6

Readme

CG-SELECT

version ~ 0.3.2.1

ЧИТАТЬ НА РУССКОМ

This component allows you to create a custom select. It offers more flexible customization and use of select. Customization, multi-selection and live search by elements are available.

The ability to customize basic elements, such as:

  • Select button.
  • List with select elements.
  • Placeholder.
  • In the multiselect mode, customization of chips (selected elements) is available.
  • Label of the element (if it was specified).
  • Switch themes from dark to light.
  • The documentation also lists all the elements for catatomization using CSS.

Installation

NPM

npm i cg-select

CDN

<script src="https://cdn.itguild.info/items/cg-select/latest/main.js"></script>

PHP

Repository: PHP cg-select package integration

Usage

To create a component, you need:

  1. Create a regular button element.
  2. Give it the cg-dropdown class.
<button class="cg-dropdown"></button>
  1. Give it a unique class, e.g. (cg-dropdown_categories).
<button class="cg-dropdown cg-dropdown_categories"></button>
  1. Create a new instance of the class (new CGSelect)
  2. Pass all desired settings as an object

All options for creating and managing are in the documentation, section "CGSelect class constructor".

An example of creating a regular select.

import CGSelect from 'cg-select';

const dropdown = new CGSelect({
  selector: '.cg-dropdown_selector',
  placeholder: 'Выберите авто',
  items: [
    'BMW',
    {
      id: '213sade',
      title: 'Opel',
      value: 1,
    },
    'Mersedes',
    'MAN',
    'Ferari',
  ],
});

An example of initialization a CGSelect in React.

import { useEffect } from 'react';
import CGSelect from 'cg-select';

const App = () => {
  useEffect(() => {
    const drop = new CGSelect({
      selector: '.cg-dropdown_selector',
      placeholder: 'Выберите авто',
      items: [
        'BMW',
        {
          id: '213sade',
          title: 'Opel',
          value: 1,
        },
        'Mersedes',
        'MAN',
        'Ferari',
      ],
    });
  }, []);

  return (
    <div className="App">
      <button className="cg-dropdown cg-dropdown_selector"></button>
    </div>
  );
};

An example of initialization a CGSelect in Vue.

<template>
  <div>
    <button class="cg-dropdown cg-dropdown_selector"></button>
  </div>
</template>

<script>
import CGSelect from "cg-select";

export default {
  mounted() {
    const drop = new CGSelect({
      selector: ".cg-dropdown_selector",
      placeholder: "Выберите авто",
      items: [
        "BMW",
        {
          id: "213sade",
          title: "Opel",
          value: 1,
        },
        "Mersedes",
        "MAN",
        "Ferari",
      ],
    });
    console.log(drop);
  },
};
</script>

Example of different selects

View live example

Built-in themes are also available: dark, white. To apply them, specify the theme attribute in the select settings and pass one of the values ​​into it dark or white.

All documentation on CG-SELECT is located in the folder of the same name. The documentation describes all methods and variables, there are also examples of passing settings to select. You can also open it on the page with an example, or follow the link below.

Documentation

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Compatibility

| Application Compatibility | JS | React | Angular | Vue | | ------------------------- | :----------------------------------------------------------------------: | :----------------------------------------------------------------------: | :---------------------------------------------------------------------: | :----------------------------------------------------------------------: | | CG-SELECT | image | image | image | image | | Comment | Tested in Js applications and it works. | The select is initiated inside the useEffect() hook | not yet available | The select is initiated inside the mounted() hook |

History

16.12.2022 - release version 0.1.0!

20.01.2023 - upgrade to version 0.2.1

06.03.2023 - upgrade to version 0.3.0