Skip to content

Commit cd9c523

Browse files
committed
Rename format -> template.
1 parent f4ea5e4 commit cd9c523

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

components/dash-core-components/src/components/RangeSlider.react.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ RangeSlider.propTypes = {
126126
'bottomRight',
127127
]),
128128
/**
129-
* Format to apply to the tooltip
130-
* The string must contain `{value}`
129+
* Template string to display the tooltip in.
130+
* Must contain `{value}`, which will be replaced with either
131+
* the default string representation of the value or the result of the
132+
* transform function if there is one.
131133
*/
132-
format: PropTypes.string,
134+
template: PropTypes.string,
133135
/**
134136
* Custom style for the tooltip.
135137
*/

components/dash-core-components/src/components/Slider.react.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ Slider.propTypes = {
108108
'bottomRight',
109109
]),
110110
/**
111-
* Format to apply to the tooltip
112-
* The string must contain `{value}`
111+
* Template string to display the tooltip in.
112+
* Must contain `{value}`, which will be replaced with either
113+
* the default string representation of the value or the result of the
114+
* transform function if there is one.
113115
*/
114-
format: PropTypes.string,
116+
template: PropTypes.string,
115117
/**
116118
* Custom style for the tooltip.
117119
*/

components/dash-core-components/src/fragments/RangeSlider.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export default class RangeSlider extends Component {
8585
*/
8686
tipProps = pipe(
8787
assoc('visible', tooltip.always_visible),
88-
omit(['always_visible', 'format', 'style', 'transform'])
88+
omit(['always_visible', 'template', 'style', 'transform'])
8989
)(tooltip);
90-
if (tooltip.format || tooltip.style || tooltip.transform) {
90+
if (tooltip.template || tooltip.style || tooltip.transform) {
9191
tipFormatter = tipValue => {
9292
let t = tipValue;
9393
if (tooltip.transform) {
@@ -96,7 +96,7 @@ export default class RangeSlider extends Component {
9696
return (
9797
<div style={tooltip.style}>
9898
{formatSliderTooltip(
99-
tooltip.format || '{value}',
99+
tooltip.template || '{value}',
100100
t
101101
)}
102102
</div>

components/dash-core-components/src/fragments/Slider.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export default class Slider extends Component {
8585
*/
8686
tipProps = pipe(
8787
assoc('visible', tooltip.always_visible),
88-
omit(['always_visible', 'format', 'style', 'transform'])
88+
omit(['always_visible', 'template', 'style', 'transform'])
8989
)(tooltip);
90-
if (tooltip.format || tooltip.style || tooltip.transform) {
90+
if (tooltip.template || tooltip.style || tooltip.transform) {
9191
tipFormatter = tipValue => {
9292
let t = tipValue;
9393
if (tooltip.transform) {
@@ -96,7 +96,7 @@ export default class Slider extends Component {
9696
return (
9797
<div style={tooltip.style}>
9898
{formatSliderTooltip(
99-
tooltip.format || '{value}',
99+
tooltip.template || '{value}',
100100
t
101101
)}
102102
</div>

components/dash-core-components/tests/integration/sliders/test_sliders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def test_sls016_sliders_format_tooltips(dash_dcc):
571571
max=100,
572572
id="slider",
573573
tooltip={
574-
"format": "Custom tooltip: {value}",
574+
"template": "Custom tooltip: {value}",
575575
"always_visible": True,
576576
"style": {"padding": "8px"},
577577
},
@@ -581,7 +581,7 @@ def test_sls016_sliders_format_tooltips(dash_dcc):
581581
min=20,
582582
max=100,
583583
id="range-slider",
584-
tooltip={"format": "Custom tooltip: {value}", "always_visible": True},
584+
tooltip={"template": "Custom tooltip: {value}", "always_visible": True},
585585
),
586586
dcc.Slider(
587587
min=20,

0 commit comments

Comments
 (0)