ant-design/components/slider/demo/tip-formatter.md
yykoypj aa97494625
feat: change slide tooltip api (#37000)
* feat: change slide tooltip api

* fix: deprecated warning

* refactor: remove boolean type support for Slider tooltip

* feat: update warning text

* chore: fix typo

* chore: save prod perf

* test: back of test case

* chore: clean up

* chore: fix test require

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2022-08-17 15:47:22 +08:00

590 B

order title
3
zh-CN en-US
自定义提示 Customize tooltip

zh-CN

使用 tooltip.formatter 可以格式化 Tooltip 的内容,设置 tooltip.formatter={null},则隐藏 Tooltip

en-US

Use tooltip.formatter to format content of Tooltip. If tooltip.formatter is null, hide it.

import { Slider } from 'antd';
import React from 'react';

const formatter = (value: number) => `${value}%`;

const App: React.FC = () => (
  <>
    <Slider tooltip={{ formatter }} />
    <Slider tooltip={{ formatter: null }} />
  </>
);

export default App;