Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
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). | |
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 | function | undefined | Callback on position change, returns current position percentage as argument (position) => { ... } . | |
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.
The npm package react-compare-slider receives a total of 27,461 weekly downloads. As such, react-compare-slider popularity was classified as popular.
We found that react-compare-slider demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.