diff --git a/README.md b/README.md
index 361e906..83882ed 100644
--- a/README.md
+++ b/README.md
@@ -168,7 +168,7 @@ ReactDOM.render(, container);
tipFormatter |
function or `null` |
|
- Format the value of the tooltip if it shows. If `null` the tooltip will always be hidden. |
+ Format the value of the tooltip if it shows. If `null` the tooltip will always be hidden. When given a function, the first argument will be the value and the second will be the index of the slider handle. |
| dots |
diff --git a/src/Handle.jsx b/src/Handle.jsx
index 7cb131d..a75e475 100644
--- a/src/Handle.jsx
+++ b/src/Handle.jsx
@@ -34,6 +34,7 @@ export default class Handle extends React.Component {
value,
dragging,
noTip,
+ index,
} = this.props;
const style = vertical ? { bottom: `${offset}%` } : { left: `${offset}%` };
@@ -55,7 +56,7 @@ export default class Handle extends React.Component {
prefixCls={tooltipPrefixCls || `${prefixCls}-tooltip`}
placement="top"
visible={isTooltipVisible}
- overlay={{tipFormatter(value)}}
+ overlay={{tipFormatter(value, index)}}
delay={0}
transitionName={tipTransitionName}
>
@@ -76,4 +77,5 @@ Handle.propTypes = {
value: React.PropTypes.number,
dragging: React.PropTypes.bool,
noTip: React.PropTypes.bool,
+ index: React.PropTypes.number,
};
diff --git a/src/Slider.jsx b/src/Slider.jsx
index b5e03e1..8a10ba1 100644
--- a/src/Slider.jsx
+++ b/src/Slider.jsx
@@ -486,6 +486,7 @@ class Slider extends React.Component {
value: v,
offset: offsets[i],
dragging: handle === i,
+ index: i,
key: i,
ref: `handle-${i}`,
}));