Skip to content

Commit 798a974

Browse files
emunsingphilippjfr
andauthored
Set placeholder for IntInput (Fixes #8359) (#8360)
* Set placeholder for IntInput * Add test and move placeholder onto SpinnerBase --------- Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
1 parent 6dcec02 commit 798a974

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

panel/tests/widgets/test_input.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,3 +483,14 @@ def test_file_input_save_one_file(document, comm, tmpdir):
483483
assert fpath.exists()
484484
content = fpath.read_text()
485485
assert content == 'Some text\n'
486+
487+
def test_int_input_placeholder(document, comm):
488+
489+
int_input = IntInput(placeholder='Foo', name='IntInput')
490+
491+
widget = int_input.get_root(document, comm=comm)
492+
493+
assert widget.placeholder == "Foo"
494+
495+
int_input.placeholder = "Bar"
496+
assert widget.placeholder == "Bar"

panel/widgets/input.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,9 @@ class _SpinnerBase(_NumericInputBase):
993993
Defines the multiplication factor applied to step when the page up
994994
and page down keys are pressed.""")
995995

996+
placeholder = param.String(default='', doc="""
997+
Placeholder when the value is empty.""")
998+
996999
wheel_wait = param.Integer(default=100, doc="""
9971000
Defines the debounce time in ms before updating `value_throttled` when
9981001
the mouse wheel is used to change the input.""")

0 commit comments

Comments
 (0)