The powerful data exploration & web app framework for Python.
—
Advanced reactive programming system for creating property links between Panel components and Bokeh models. Enables sophisticated reactive patterns and cross-component data synchronization without Python callback overhead.
Core classes for establishing reactive links between component properties.
class Link:
"""
Base class for linking properties between components.
Parameters:
- source: Source component with properties to link from
- target: Target component with properties to link to
- properties: Dictionary mapping source properties to target properties
- bidirectional: Whether link should work in both directions
"""
class Callback:
"""
Base callback class for reactive programming patterns.
Parameters:
- source: Source component to watch for changes
- target: Target component to update
- code: JavaScript or Python code to execute on changes
"""High-performance client-side property linking using JavaScript callbacks.
class JSCallbackGenerator:
"""Generates JavaScript callbacks for client-side property linking"""
class JSLinkCallbackGenerator:
"""Specialized generator for JavaScript property links between components"""import panel as pn
# Create components
slider = pn.widgets.IntSlider(start=0, end=100, value=50)
number_input = pn.widgets.NumberInput(value=50)
# Link slider value to number input
pn.links.Link(slider, number_input, properties={'value': 'value'})
# Bidirectional linking
pn.links.Link(slider, number_input, properties={'value': 'value'}, bidirectional=True)import panel as pn
# High-performance client-side linking
text_input = pn.widgets.TextInput(value="Hello")
markdown = pn.pane.Markdown("Hello")
# JavaScript link for immediate updates without server roundtrip
pn.links.JSLink(text_input, markdown, properties={'value': 'object'})The links system is essential for building responsive applications with complex component interactions and is particularly valuable for performance-critical applications where minimizing server roundtrips is important.