
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
react-switchbox
Advanced tools
A dropdown, and search component for React applications
npm install --save react-switchbox
import Switchbox from 'react-switchbox'
The switchbox component takes one prop type:
options
The options prop is an object detailing all the rules for the switchbox
Here is an example options
object prop:
const options = this.props.options || {
type: 'dropdown',
data: ['things', 'to', 'display']
iconPosition: 'right',
hideIcon: false,
defaultValue: 'drop for something.',
maxItems: 10,
itemHeight: 22,
onChange: (searchQuery) => { console.log(`${searchQuery} is being returned`) },
onSelect: (selectedItem) => { console.log(`user has selected ${selectedItem}`) }
}
type
: Either dropdown
or search
, defaults to dropdown
data
: The data that will be used in the search
or dropdown
iconPosition
: Either left
or right
, defaults to right
hideIcon
: true
or false
, defaults to true
defaultValue
: The default text displayed in the switchbox
maxItems
: A limit on how many items can be displayed, defaults to 10
itemHeight
: The height of each item in the dropdowns
onChange
: A callback that return the text typed into the switchbox. this is
used to filter and refine your search ( must be implemented yourself )
onSelect
: A callback that returns the value of the item selected in the dropdown of the switchbox.
export default class App extends Component {
render () {
return (
<Switchbox options={options}/>
)
}
}
© Perple Corp.
Author: Kyle Kilbride
FAQs
Dropdown and search component for React applications.
We found that react-switchbox 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.