WrappedComponent¶
-
class
dash_component_template.template.WrappedComponent(component, parent=None)[source]¶ Bases:
dash_component_template.template.Template,dash_component_template.template.ComponentFactoryMixinA thin wrapper round a Dash component instance.
The id is the id of the wrapped Dash component.
Instance of this class is typically created by the
Template.child()factory method with the first argument being a Dash component instance.Attributes Summary
dash_component_infoidThe unique id. idbaseThe base name to use for generated unique id. layoutImplement this to return a valid Dash layout object. Methods Summary
setup_layout(app)Implement this to declare layout components and their callbacks. Attributes Documentation
-
dash_component_info= None¶
-
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
-