JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q41662F
  • License ISC

Package Exports

  • react-dropdown-package
  • react-dropdown-package/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-dropdown-package) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Dropdown Package

A simple React dropdown component.

Tech Stack

Component: React, Typescript, TailwindCSS

Installation

Install react-dropdown-package with npm

  npm install react-dropdown-package
  cd react-dropdown-package

Prerequisites

To deploy this project you need to have :

  • ajv@>=8
  npm install ajv
  • ajv-keywords>=5.1.0
  npm install ajv-keywords
  • typescript@>=2.7
  npm install typescript

Usage

import React from 'react';
import Dropdown from 'react-dropdown-package/src/index.js';
import 'your-custom-styles.css';

const options = [
  { value: 'option1', label: 'Option 1' },
  { value: 'option2', label: 'Option 2' },
  { value: 'option3', label: 'Option 3' }
];

const handleSelect = (option) => {
  console.log(option);
};

const App = () => (
  <Dropdown
    options={options}
    onSelect={handleSelect}
    className="my-dropdown"
    toggleClassName="my-toggle"
    menuClassName="my-menu"
    itemClassName="my-item"
  />
);

export default App;

Props

options (array): Les options du dropdown.

`onSelect` (function): Fonction appelée lors de la sélection d'une option.
`className` (string): Classe CSS personnalisée pour le conteneur du dropdown.
`toggleClassName` (string): Classe CSS personnalisée pour le bouton de toggle.
`menuClassName` (string): Classe CSS personnalisée pour le menu.
`itemClassName` (string): Classe CSS personnalisée pour les items du menu.