
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.
react-compare-slider
Advanced tools
A slider component to compare any two React components in landscape or portrait orientation. It supports custom images, videos... and everything else.
picture
, video
, canvas
, iframe
etc.)useReactCompareSliderRef
npm install react-compare-slider
# or
yarn add react-compare-slider
# or
pnpm add react-compare-slider
You may use ReactCompareSliderImage
to render images or use your own custom
components.
import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider';
export const Example = () => {
return (
<ReactCompareSlider
itemOne={<ReactCompareSliderImage src="..." srcSet="..." alt="Image one" />}
itemTwo={<ReactCompareSliderImage src="..." srcSet="..." alt="Image two" />}
/>
);
};
Prop | Type | Required | Default | Description |
---|---|---|---|---|
boundsPadding | number | 0 | Padding to limit the slideable bounds in pixels on the X-axis (landscape) or Y-axis (portrait). | |
browsingContext | globalThis | globalThis | Context to bind events to (useful for iframes). | |
changePositionOnHover | boolean | false | Whether the slider should follow the pointer on hover. | |
disabled | boolean | false | Whether to disable slider movement (items are still interactable). | |
handle | ReactNode | undefined | Custom handle component. | |
itemOne | ReactNode | ✓ | undefined | First component to show in slider. |
itemTwo | ReactNode | ✓ | undefined | Second component to show in slider. |
keyboardIncrement | number|`${number}%` | 5% | Percentage or pixel amount to move when the slider handle is focused and keyboard arrow is pressed. | |
onlyHandleDraggable | boolean | false | Whether to only change position when handle is interacted with (useful for touch devices). | |
onPositionChange | (position: number) => void | undefined | Callback on position change, returns current position percentage as argument. | |
portrait | boolean | false | Whether to use portrait orientation. | |
position | number | 50 | Initial percentage position of divide (0-100 ). | |
transition | string | undefined | Shorthand CSS transition property to apply to handle movement. E.g. .5s ease-in-out |
API docs for more information.
Checkout out the Real World Examples page.
FAQs
A slider component to compare any two React components in landscape or portrait orientation. It supports custom images, videos... and everything else.
We found that react-compare-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.