@fseehawer/react-circular-slider

中文文档
3.3.7发布于 2026/09/07TypeScriptESM + CJS零依赖近 30 天下载 4.3万

A customizable circular slider with no dependencies.

此软件包已被标记为弃用

Moved to @fiojs/react-circular-slider. Update your dependency and imports. Migration guide: https://www.npmjs.com/package/@fiojs/react-circular-slider

原始使用文档
文档目录7 节
  1. TypeScript Support
  2. Installation
  3. Example
  4. Configuration Examples
  5. Configuration Notes
  6. Props
  7. License

react-circular-slider

Version License: MIT

A highly customizable circular slider with zero dependencies. Check out the live demos!

An image showing the CircularSlider settings

TypeScript Support

This component includes TypeScript types for the component props, ref handle, knob positions, and gradient stops.

JavaScript users: no worries - the published output is plain JavaScript and works exactly as before.

Installation

npm install @fseehawer/react-circular-slider

Example

import React from 'react';
import CircularSlider from '@fseehawer/react-circular-slider';

const App = () => (
    <CircularSlider onChange={(value) => console.log(value)} />
);

export default App;

Configuration Examples

See the live demos for copy-ready examples covering labels, colors, custom data, knob content, multi-stop gradients, and arc gauges.

Configuration Notes

  • Use data for custom labels or non-linear steps; use min and max for inclusive numeric ranges.
  • Use dataIndex to choose the selected item in data, and value only when controlling the slider by degrees.
  • Use ariaLabel when the visible label is abbreviated, hidden, or not descriptive enough for assistive technology.
  • Use arcStart and arcEnd for gauge-style sliders. Add trackDraggable when users should be able to click or drag the track.
  • In arc mode, gradient stops run from arcStart to arcEnd, which keeps gauge colors in value order.

Props

The table below lists all available props along with their TypeScript types, default values, and descriptions.

PropTypeDefaultDescription
widthnumber280Width of the slider in pixels.
direction1 | -11Rotation direction: 1 for clockwise, -1 for anticlockwise.
minnumber0Minimum value.
maxnumber360Maximum value.
initialValuenumber0Initial value for the label.
valuenumberundefinedControlled value in degrees.
data(string | number)[][]Array of values or labels, evenly spread over the slider.
dataIndexnumber0Initial or controlled index position in the data array.
knobColorstring"#4e63ea"Color of the knob.
knobSizenumber36Diameter of the knob in pixels.
hideKnobbooleanfalseIf true, the knob is hidden.
hideKnobRingbooleanfalseIf true, the translucent ring around the knob is hidden.
knobDraggablebooleantrueIf true, the knob is draggable.
knobPositionstring | number"top"Starting position: accepts "top", "right", "bottom", "left" or an angle (in degrees).
labelstring"ANGLE"Text label displayed on the slider.
ariaLabelstringundefinedAccessible label for the slider control. Falls back to label.
labelColorstring"#272b77"Color of the label and value text.
labelBottombooleanfalseIf true, the label is positioned below the slider.
labelFontSizestring"1rem"Font size of the label.
valueFontSizestring"3rem"Font size of the displayed value.
appendToValuestring""Text appended to the value.
prependToValuestring""Text prepended to the value.
renderLabelValueReact.ReactNodenullCustom JSX for rendering the label and value.
verticalOffsetstring"1.5rem"Vertical offset for the label/value display.
hideLabelValuebooleanfalseIf true, both the label and value are hidden.
progressColorFromstring"#80C3F3"Start color for the progress gradient.
progressColorTostring"#4990E2"End color for the progress gradient.
progressSizenumber8Thickness of the progress track.
progressLineCap"round" | "butt""round"Cap style for the progress track.
useMouseAdditionalToTouchbooleanfalseIf true, also listens for mouse input on touch-capable devices.
trackColorstring"#DDDEFB"Color of the background track.
trackSizenumber8Thickness of the background track.
trackDraggablebooleanfalseIf true, clicking or dragging the background track updates the value.
progressGradient(string | GradientStop)[]undefinedArray of color stops for a multi-stop progress gradient. Overrides progressColorFrom/To. Each stop can be a color string or { offset, stopColor, stopOpacity }.
trackGradient(string | GradientStop)[]undefinedArray of color stops for a multi-stop track gradient. Overrides trackColor.
arcStartnumberundefinedStart angle (in degrees) for arc mode. Use with arcEnd to create a partial-circle gauge (e.g. 225 for lower-left).
arcEndnumberundefinedEnd angle (in degrees) for arc mode. Use with arcStart (e.g. 135 for lower-right = 270° speedometer sweep).
childrenReact.ReactNodeundefinedCustom knob content.
limitDragRangebooleanfalseIf true, clamps drag movement to the configured data range.
onChange(value: string | number) => void() => {}Callback fired when the value changes.
isDragging(dragging: boolean) => void() => {}Callback to signal whether the slider is being dragged.

License

MIT License

版本与发布记录

@fseehawer/react-circular-slider 共发布 145 个版本,首次发布于 2019/09/25;过去 12 个月发布了 7 个版本。

版本发布日期距今
3.3.7latest2026/09/072 个月前
3.3.62026/09/052 个月前
3.3.52026/08/242 个月前
3.3.42026/08/242 个月前
3.3.32026/03/068 个月前
3.3.02026/03/048 个月前

关于 @fseehawer/react-circular-slider 的常见问题

@fseehawer/react-circular-slider 是什么?

A customizable circular slider with no dependencies.注意:该包已被作者标记为弃用——Moved to @fiojs/react-circular-slider. Update your dependency and imports. Migration guide: https://www.npmjs.com/package/@fiojs/react-circular-slider

如何安装 @fseehawer/react-circular-slider?

在项目目录运行 npm install @fseehawer/react-circular-slider,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^17.0.0 || ^18.0.0 || ^19.0.0)、react-dom(^17.0.0 || ^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fseehawer/react-circular-slider 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fseehawer/react-circular-slider 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fseehawer/react-circular-slider 可以商用吗?

@fseehawer/react-circular-slider 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@fseehawer/react-circular-slider 的下载量有多少?

根据 npm 官方下载统计,@fseehawer/react-circular-slider 在 2026/10/16 – 2026/11/14 这 30 天内被下载 42,571 次,日均约 1,419 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fseehawer/react-circular-slider 还在维护吗?

最新版本 3.3.7 发布于 2026/09/07(2 个月前);至今共发布 145 个版本,其中过去 12 个月发布了 7 个;首次发布于 2019/09/25。作者已将其标记为弃用,新项目建议寻找替代方案。