🔍 Code Extractor

class Extending_row

Maturity: 28

A Panel ReactiveHTML component that renders a parameter value inside a div element with the class 'extend_row'.

File:
/tf/active/vicechatdev/resources/py2html.py
Lines:
493 - 497
Complexity:
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

  • param
  • panel

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

    A Panel ReactiveHTML component that creates a simple div container with an extendable column layout, displaying a parameter value within an HTML template.

    From: /tf/active/vicechatdev/resources/py2html.py
  • class Clickable_header 53.0% similar

    A clickable header component that displays text as a hyperlink and tracks the number of times it has been clicked.

    From: /tf/active/vicechatdev/resources/py2html.py
  • class custom_tabulator 52.0% similar

    A custom extension of Panel's Tabulator widget that overrides the _patch method to handle data updates with special logic for filtering, sorting, and remote pagination scenarios.

    From: /tf/active/vicechatdev/panel_edits/custom_tabulator.py
  • function _eval_panel 51.3% similar

    Evaluates and initializes a panel component (function, template, or panel object) within a Bokeh document context, handling different panel types and modifying the document accordingly.

    From: /tf/active/vicechatdev/patches/server.py
  • class ReviewPanel 49.4% similar

    ReviewPanel is a UI component class for managing document review workflows, providing interfaces for viewing review details, submitting review decisions, and managing review cycles.

    From: /tf/active/vicechatdev/CDocs single class/ui/review_panel.py
← Back to Browse