
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
dropdown-sample
Advanced tools
dropdown component library
npm i --save dropdown-sample
npm i --save antd
npm i --save styled-components
import React, { Component } from 'react'
import Dropdown from 'dropdown-sample'
class Example extends Component {
render () {
return (
<Dropdown
options={[
{ key: 'one', value: 'A simple option' },
{ key: 'two', value: 'A second option' },
{ key: 'three', value: 'Third and final!' },
{ key: 'four', value: 'mangos' },
]}
placeholder="Select an Option"
size="small"
onChange={() => {}}
onFocus={() => {}}
onBlur={() => {}}
/>
)
}
}
usage with icon emojis.
<Dropdown
options={[
{key: 'one', value: 'strawberry', icon: '🍓'},
{key: 'two', value: 'watermelon', icon: '🍉' },
{key: 'three', value: 'mango', icon: '🥭' },
{key: 'four', value: 'avocado', icon: '🥑' },
{key: 'five', value: 'pear', icon: '🍐' },
]}
placeholder="Select an option (w/ a cute fruit icon!)"
size="medium"
onChange={() => console.log('On change FIRED 🚀')}
onFocus={() => console.log('On focus FIRED 🚀')}
onBlur={() => console.log('On blur FIRED 🚀')}
/>
usage with icon emojis + descriptions.
<Dropdown
options={[
{key: 'one', value: 'I have a description', icon: '🍓', description: 'I am an option with a cool fancy description on the bottom!'},
{key: 'two', value: 'Option 2', icon: '🍓', description: 'If you pick me, yay!'},
{key: 'three', value: 'Watermelon', icon: '🍓', description: 'Should we make watermelons smoothies?'},
]}
placeholder="Select an option (w/ a description!)"
size="large"
onChange={() => console.log('On change FIRED 🚀')}
onFocus={() => console.log('On focus FIRED 🚀')}
onBlur={() => console.log('On blur FIRED 🚀')}
/>
Clone the repository
git clone <path_to_repo>
Install the dependancies
cd <path_to_repo>
yarn install
Start up the component library
yarn start
Open a new terminal tab and navigate to example directory
cd <path_to_repo>/example
Install the dependancies for the example react app
yarn install
Start the development server. A browser window should open with some examples of the dropdown :)
yarn start
Prop | usage |
---|---|
Options | options take a key (string), value (string), icon (emoji/string), and a description (string). |
placeholder | the placeholder before an option is selected (string) |
size | can be 'small', 'medium' or 'large' (string) |
onChange | an function thats fired when an option is selected |
onFocus | an function thats fired on component focus |
onBlur | an function thats fired on component blur |
MIT © ejdweck
FAQs
A simple dropdown component library
The npm package dropdown-sample receives a total of 0 weekly downloads. As such, dropdown-sample popularity was classified as not popular.
We found that dropdown-sample 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.