![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ocr-p14-dropdown-npm
Advanced tools
The OCR-P14-DROPDOWN-NPM component is a React Dropdown component wich is a custom dropdown list that allows users to select items from a list of choices. It is fully styled using styled-components and supports search functionality to filter displayed item
The OCR-P14-DROPDOWN-NPM component is a React Dropdown component wich is a custom dropdown list that allows users to select items from a list of choices. It is fully styled using styled-components and supports search functionality to filter displayed items. The component handle z-index so you can have multiple dropdowns and opening one will cover the other one.
To use this component, you need to install it in a React project and have already installed:
If you don't have these installed, refer yourself to the documentation of each one to install them in your project or use npm command:
npm i react react-dom styled-components prop-types
To install the React Dropdown component in your project, you can use npm or yarn:
npm i ocr-p14-dropdown-npm
yarn add ocr-p14-dropdown-npm
Here's how you can use the React Dropdown component in your application:
import React, { useState } from "react";
import Dropdown from "ocr-p14-dropdown-npm";
export default const YourComponent = () => {
const [selectedItem, setSelectedItem] = useState("");
const arrOfStrOrNum = ["Option 1", "Option 2", "Option 3", "Option 4"]; // arr of data to pass
return (
<div>
<h1>Example of using the Dropdown component</h1>
<Dropdown
dropdownData={arrOfStrOrNum}
onChange={(selection) => setSelectedItem(selection)}
/>
</div>
);
};
If for example, the user submit a form and you want to reset the dropdown component to its original state, you can add a state and pass the onReset props to true.
import React, { useState, useEffect } from "react";
import Dropdown from "ocr-p14-dropdown-npm";
export default const YourComponent = () => {
const [selectedItem, setSelectedItem] = useState("");
const [onResetState, setOnResetState] = useState(false);
useEffect(() => {
if(onResetState) {
setOnResetState(false);
}
}, [onResetState])
const arrOfStrOrNum = ["Option 1", "Option 2", "Option 3", "Option 4"];
return (
<div>
<h1>Example of using the Dropdown component</h1>
<Dropdown
dropdownData={arrOfStrOrNum}
onChange={(selection) => setSelectedItem(selection)}
onReset={onResetState}
name="dropdownExample"
id="dropdownExample"
/>
<button onClick={() => setOnResetState(true)}>Reset dropdown selection</button>
</div>
);
};
The Dropdown component takes the following props:
dropdownData (array, required): An array of options to display in the dropdown menu. Each element can be a string or a number.
onChange (function, required): A callback function called when the user selects an item in the dropdown. The function receives the text of the selected item as a parameter.
onReset (variable/state, optional): A boolean wich when is "true" will reset the user's selection to a default value (the first of the array of data passed).
name (variable/state, optional): a string wich will be the name of the input (for label for example)
id (variable/state, optional): a string wich will be the id of the input
The React Dropdown component is fully styled using styled-components. You can customize the styles by adding your on CSS.
The component is not optimized for very large lists of options, as it will render all the elements in the list. Its dropdown menu's height is limited to 25vh. For large amounts of data, we recommend using a virtualization library to optimize performance.
Make sure to handle changes to the parent component's state using the onChange.
The component has some default styling, feel free to add your own styles to match your application's theme.
This project is licensed under the MIT License. You are free to use, modify, and distribute it under the terms of the MIT License.
FAQs
The OCR-P14-DROPDOWN-NPM component is a React Dropdown component wich is a custom dropdown list that allows users to select items from a list of choices. It is fully styled using styled-components and supports search functionality to filter displayed item
The npm package ocr-p14-dropdown-npm receives a total of 0 weekly downloads. As such, ocr-p14-dropdown-npm popularity was classified as not popular.
We found that ocr-p14-dropdown-npm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.