For Tailwind CSS v3 docs, click here.

Balance Slider

A dynamic balance slider with adjustable colors, limits, and interactive tooltip.

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/balance-slider.json"

手动安装

复制并粘贴以下代码:

BalanceSlider.vue

API

Prop 名称类型默认值描述
initialValuenumber50Initial position of the slider (0-100).
leftColorstring"#e68a00"Background color for the left side of the slider.
rightColorstring"#ffffff"Background color for the right side of the slider.
minShiftLimitnumber40Minimum limit where shifting animation activates.
maxShiftLimitnumber68Maximum limit where shifting animation deactivates.
leftContentstring"LEFT"Text displayed in the tooltip for the left side.
rightContentstring"RIGHT"Text displayed in the tooltip for the right side.
indicatorColorstring"#FFFFFF"Color of the central indicator on the slider.

功能特性

  • Dual-Sided Color Control: Customize the left and right side colors of the slider to create a distinct balance effect.
  • Interactive Tooltip: Displays real-time percentage values for both sides, with customizable content for left and right labels.
  • Shift Animation: Activates a shifting effect within defined limits, adding an engaging visual element.
  • Responsive Indicator: Central indicator adjusts its color based on active state, enhancing interactivity.
  • Accessible Controls: Works with keyboard and touch interactions for seamless accessibility.

感谢