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

selectmenu-cmp

v0.0.30

Published

selectmenu package

Downloads

8

Readme

SelectMenu Component

The SelectMenu component is a React component that provides a customizable dropdown menu with search functionality. It allows users to select an option from a list of values and provides various customization options for appearance and behavior.

Prerequisites

To use the SelectMenu component in your React application, you need:

  1. To have node Node : ^16.15.1

  2. To have install tailwindcss : https://tailwindcss.com/docs/installation/framework-guides

Installation

To use the SelectMenu component in your React application, follow these steps:

  1. Install the package:

    npm install selectmenu-cmp
  2. Your tailwin.config.js should be like this :

    /** @type {import('tailwindcss').Config} */
     export default {
     content: [
         "./index.html",
         "./src/**/*.{js,ts,jsx,tsx}",
         './node_modules/selectmenu-cmp/**/*.{js,ts,jsx,tsx}',
     ],
     theme: {
         extend: {},
     },
     plugins: [],
     }
  3. Import the SelectMenu component into your React application:

    import SelectMenu from "selectmenu-cmp";
  4. You can now use the SelectMenu component in your application.

Usage

You can find exemples in the folder src/examples of this repository. Here's an example of how to use the SelectMenu component:

import React, { useState } from 'react';
import SelectMenu from "selectmenu-cmp";

function App() {
  const [selectedValue, setSelectedValue] = useState('');
  const values = [
    { name: 'Option 1' },
    { name: 'Option 2' },
    { name: 'Option 3' },
  ];

  return (
    <div>
      <h1>SelectMenu Example</h1>
      <SelectMenu
        id="mySelectMenu"
        values={values}
        inputValue={selectedValue}
        setter={setSelectedValue}
        width={'350px'}
        inputHeight={'45px'}
        backgroundColor={"orange"}
        textColor={"red"}
        activeColor={"blue"}
        inputTextColor={"orange"}
        inputBackgroundColor={"#ffe9d3"}
        iconColor={"orange"}
      />
    </div>
  );
}

export default App;

Props

The SelectMenu component accepts the following props:

  • id (string, required): A unique identifier for the component.
  • values (array of objects, required): An array of options to display in the dropdown.
  • inputValue (string, required): The currently selected value.
  • setter (function, required): A function to set the selected value.
  • isError (bool, required): Indicates whether there is an error in the component.
  • width (string): The width of the component (default: '100%').
  • inputHeight (string): The height of the input field (default: '45px').
  • backgroundColor (string): The background color of the component (default: 'transparent').
  • textColor (string): The text color of the component (default: 'black').
  • inputBackgroundColor (string): The background color of the input field (default: 'transparent').
  • inputTextColor (string): The text color of the input field (default: 'black').
  • iconColor (string): The color of the dropdown icon (default: 'black').
  • activeColor (string): The background color of the selected option (default: '#D0E7B9').

License

This component is open-source and available under the MIT License.