NullComponent

class dash_component_template.NullComponent(id, parent=None)[source]

Bases: dash_component_template.template.Template

A component template that does not represent an actual component.

This is useful to serve as a root to build standalone layout that does not attached immediately to the main Dash app layout tree.

Attributes Summary

id The unique id.
idbase The base name to use for generated unique id.
layout Implement this to return a valid Dash layout object.

Methods Summary

setup_layout(app) Implement this to declare layout components and their callbacks.

Attributes Documentation

id

The unique id.

idbase

The base name to use for generated unique id.

layout

Implement this to return a valid Dash layout object.

Methods Documentation

setup_layout(app)[source]

Implement this to declare layout components and their callbacks.

This base implementation has to be called in the subclass implementation to ensure any child templates also get properly setup. This is particularly important for templates that contain templates in their descendants.

The convention is to structure the implementation in the following way:

def setup_layout(self, app):
    child0 = self.child(some_dash_type, ...)
    child1 = child0.child(some_template_cls, ...)
    # This will trigger `setup_layout` call to all the children,
    # which may make available some attributes
    super().setup_layout(app)

    @app.callback(...)
    def some_callback(...):
        return