
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
react-proportion-slider
Advanced tools
Note: This package is currently in beta.
A React component that allows users to adjust the proportion of two elements using a slider.
npm install react-proportion-slider
yarn add react-proportion-slider
function App() {
const [proportions, setProportions] = React.useState<[number, number]>([
50, 50,
]);
return (
<div>
<ProportionSlider
value={proportions}
width={500}
proportions={[
{
label: "Skill",
backgroundColor: "#31332E",
},
{
label: "3.7 Sonnet",
backgroundColor: "#5f625C",
},
]}
onChange={(change) => {
setProportions(change);
}}
knobOptions={{
width: 5,
gap: 5,
backgroundColor: "#EC1308",
}}
height={50}
/>
</div>
);
}
| Prop Name | Type | Required | Description |
|---|---|---|---|
| value | [number, number] | Yes | Current values of the two proportions [left, right] |
| proportions | [ProportionDetail, ProportionDetail] | Yes | Details for the two proportions [left, right] |
| onChange | (values: [number, number]) => void | No | Callback when values change |
| knobOptions | SliderKnobOptions | No | Appearance of the slider knob |
| height | number | No | Height of the slider in pixels |
| width | number | No | Width of the slider in pixels |
| disabled | boolean | No | Whether the slider is disabled |
| className | string | No | Custom class name for the slider container |
| style | React.CSSProperties | No | Custom styles for the slider container |
| ariaLabel | string | No | Accessibility label for the slider |
| Property | Type | Required | Description |
|---|---|---|---|
| label | string | Yes | Custom label to display |
| backgroundColor | string | No | Color of the proportion segment |
| data | any | No | Optional data to associate with this proportion |
| ariaLabel | string | No | Accessibility label for this proportion |
| Property | Type | Required | Description |
|---|---|---|---|
| width | number | No | Width of the slider knob in pixels |
| gap | number | No | Gap around the slider knob in pixels |
| backgroundColor | string | No | Color of the slider knob |
| className | string | No | Custom class name for the knob |
| style | React.CSSProperties | No | Custom styles for the knob |
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default tseslint.config({
extends: [
// Remove ...tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
// other options...
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
},
});
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from "eslint-plugin-react-x";
import reactDom from "eslint-plugin-react-dom";
export default tseslint.config({
plugins: {
// Add the react-x and react-dom plugins
"react-x": reactX,
"react-dom": reactDom,
},
rules: {
// other rules...
// Enable its recommended typescript rules
...reactX.configs["recommended-typescript"].rules,
...reactDom.configs.recommended.rules,
},
});
FAQs
> **Note:** This package is currently in beta.
The npm package react-proportion-slider receives a total of 1 weekly downloads. As such, react-proportion-slider popularity was classified as not popular.
We found that react-proportion-slider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.