class Extending_row
A Panel ReactiveHTML component that renders a parameter value inside a div element with the class 'extend_row'.
/tf/active/vicechatdev/resources/py2html.py
493 - 497
simple
Purpose
Extending_row is a custom Panel component that extends ReactiveHTML to create a simple container div that displays a parameter value. It's designed to be used within Panel dashboards or applications where you need a reactive HTML element that updates when its parameter changes. The component wraps content in a div with specific styling class 'extend_row', making it useful for creating extensible row layouts in Panel applications.
Source Code
class Extending_row(ReactiveHTML):
parameter = param.Parameter()
_template = """
<div class="extend_row" id="extend_row">${parameter}</div>
"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ReactiveHTML | - |
Parameter Details
parameter: A generic param.Parameter that can hold any value. This parameter's value will be rendered inside the div element. When this parameter changes, the HTML template will automatically update to reflect the new value. No type constraints are specified, so it can accept any Python object that can be converted to a string representation for display.
Return Value
Instantiating this class returns an Extending_row object, which is a Panel ReactiveHTML component. This object can be added to Panel layouts, served in Panel applications, or used anywhere Panel components are accepted. The component itself renders as HTML with the parameter value displayed inside a div element.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
parameter |
param.Parameter | A generic parameter that holds the value to be displayed in the HTML template. Can be any Python object. Changes to this attribute trigger automatic re-rendering of the component. | class |
_template |
str | The HTML template string that defines the component's structure. Contains a div element with class and id 'extend_row' that displays the parameter value using ${parameter} template syntax. | class |
Dependencies
parampanel
Required Imports
import param
import panel as pn
from panel.reactive import ReactiveHTML
Usage Example
import param
import panel as pn
from panel.reactive import ReactiveHTML
class Extending_row(ReactiveHTML):
parameter = param.Parameter()
_template = '''
<div class="extend_row" id="extend_row">${parameter}</div>
'''
# Instantiate the component with a parameter value
row = Extending_row(parameter='Hello, World!')
# Display in a Panel application
row.servable()
# Or add to a layout
layout = pn.Column(row)
# Update the parameter dynamically
row.parameter = 'Updated content'
# The HTML will automatically update to show the new value
Best Practices
- This component inherits from ReactiveHTML, so it automatically handles reactive updates when the parameter changes
- The parameter attribute can be set during instantiation or modified later to update the displayed content
- The _template attribute defines the HTML structure and should not be modified after class definition
- Use CSS to style the 'extend_row' class for custom appearance
- The component is designed to be embedded in Panel layouts (Column, Row, etc.) or served directly
- Since parameter is untyped, ensure the value you assign can be meaningfully rendered as a string in HTML
- The id 'extend_row' in the template allows for JavaScript interactions if needed
- This component follows Panel's reactive programming model - changes to parameters automatically trigger UI updates
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Extending_column 87.8% similar
-
class Clickable_header 53.0% similar
-
class custom_tabulator 52.0% similar
-
function _eval_panel 51.3% similar
-
class ReviewPanel 49.4% similar