
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@humanz/react-compound-slider
Advanced tools
Welcome to the future. React Compound Slider is a tiny (5kb) slider component with no opinion about markup or styles.
React Compound Slider is available as an npm package.
To install and save in your package.json
dependencies, run:
npm install react-compound-slider
Compound component design provides maximum customizability ✓
Horizontal/vertical display ✓
The display of values can be reversed ✓
Supports mouse and touch events ✓
Create any type of slider ✓
Automatically generates uniformly spaced, human-readable tick values to label your slider ✓
Integrates seemlessly with any app styling approach ✓
Interaction modes ✓
Works as a controlled component ✓
import Slider from 'react-compound-slider'
import { Handle, Track, Tick } from './your-local-slider-components'
<Slider
rootStyle={sliderStyle}
domain={[0, 100]} // [min, max]
step={1}
mode={2} // 1 = allow-crossing, 2 = no crossing, 3 = pushable (also custom modes)
values={[10, 20, 30]} // one value would be a value slider, two a range slider, etc
>
<Slider.Handles>
{({ handles, getHandleProps }) => (
<div className="slider-handles">
{handles.map(handle => (
...render your handle here
))}
</div>
)}
</Slider.Handles>
<Slider.Tracks left={false} right={false}> // you can toggle the left and right tracks
{({ tracks, getTrackProps }) => (
<div className="slider-tracks">
{tracks.map(({ id, source, target }) => (
...render your track here
))}
</div>
)}
</Slider.Tracks>
</Slider>
This library takes a compound component approach to creating sliders that separates the data/logic from presentation.
If your familiar with Kent Dodd's work on Paypal's downshift or react-toggled then the pattern should seem familiar. The components use the function as child components pattern.
In practical terms this means you can create just about any kind of slider you can imagine and use whatever style approach you want.
By taking this approach it also frees you up to render whatever markup you want to customize your slider.
The Slider
streams you the data and really only cares about the dimensions of the outer div where it takes its measurements from.
In general slider components are composed of a relatively positioned outer div with elements absolutely positioned inside by a percentage.
In this library the Handles
, Tracks
, and Ticks
components are used as children to the Slider
component and they let you tap into a stream of values and percentages that you can then use to render your own components.
FAQs
Futuristic react slider component
The npm package @humanz/react-compound-slider receives a total of 99 weekly downloads. As such, @humanz/react-compound-slider popularity was classified as not popular.
We found that @humanz/react-compound-slider 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.