Skip to content

Commit

Permalink
Sync value_input and value
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 14, 2025
1 parent d31eb0c commit d22234a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/panel_material_ui/widgets/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import param
from panel.models.reactive_html import DOMEvent
from panel.util import edit_readonly
from panel.widgets.input import FileInput as _PnFileInput

from ..base import COLORS
Expand Down Expand Up @@ -44,6 +45,7 @@ class _TextInputBase(MaterialWidget):
value_input = param.String(
default="",
allow_None=True,
readonly=True,
doc="""
Initial or entered text value updated on every key press.""",
)
Expand All @@ -52,6 +54,10 @@ class _TextInputBase(MaterialWidget):

__abstract = True

@param.depends('value', watch=True, on_init=True)
def _sync_value_input(self):
with edit_readonly(self):
self.value_input = self.value


class TextInput(_TextInputBase):
Expand Down

0 comments on commit d22234a

Please sign in to comment.