Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-simple-dropdown
Advanced tools
Non-prescriptive React.js dropdown toolkit.
This module is designed for use with Browserify (but should work with anything CommonJS compatible). You can easily install it with npm:
npm install react-simple-dropdown
This module provides three React components that you can use as a basis for any kind of dropdown menu:
DropdownTrigger
: The element that will cause your dropdown to appear when clicked.DropdownContent
: Contains the "filling" of your dropdown. Generally, this is a list of links.Dropdown
: The base element for your dropdown. This contains both the DropdownTrigger
and the DropdownContent
, and handles communication between them.There is also a barebones stylesheet which must be included in order for the component to actually work.
Keep in mind that DropdownTrigger
and DropdownContent
must be direct children of Dropdown
. Here's a quick example:
var React = require('react');
var Dropdown = require('react-simple-dropdown');
var DropdownTrigger = Dropdown.DropdownTrigger;
var DropdownContent = Dropdown.DropdownContent;
var Menu = React.createClass({
render: function () {
return (
<Dropdown>
<DropdownTrigger>Profile</DropdownTrigger>
<DropdownContent>
<img src="avatar.jpg" /> Username
<ul>
<li>
<a href="/profile">Profile</a>
</li>
<li>
<a href="/favorites">Favorites</a>
</li>
<li>
<a href="/logout">Log Out</a>
</li>
</ul>
</DropdownContent>
</Dropdown>
)
}
});
Options can be passed to Dropdown
as props. A list of available options can be found below. These must be passed to the containing Dropdown
component.
Property | Type | Description |
---|---|---|
active | boolean | Manually show/hide the DropdownContent . Make sure to unset this or the dropdown will stay open. |
disabled | boolean | Disable toggling of the dropdown by clicking on DropdownTrigger . Toggling with active , show() , and hide() is still possible. |
removeElement | boolean | Remove the DropdownContent element when inactive (rather than just hide it). |
onShow | function | Callback for when DropdownContent is shown. |
onHide | function | Callback for when DropdownContent is hidden. |
Each instance of Dropdown
has some methods developers might find useful.
Method | Description |
---|---|
show | Shows the dropdown. |
hide | Hides the dropdown. |
isActive | Returns a boolean indicating whether or not the dropdown is active. |
FAQs
Non-prescriptive React.js dropdown toolkit
The npm package react-simple-dropdown receives a total of 7,933 weekly downloads. As such, react-simple-dropdown popularity was classified as popular.
We found that react-simple-dropdown 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.