Skip to content

Collapsive header does not accept a singular dash component as children argument #229

Description

@mhwaage

From the docstring of CollapsiveHeader:

"""Creates a collapsible box with a large header label.

    Keyword arguments:

    - children (a list of or a singular dash component, string or number; required):
        The children of this component.
...
"""

However, if we pass anything other than a list as children argument, we are presented with the error:

***\site-packages\webviz_core_components\wrapped_components\collapsive_header.py", line 27, in __init__
    self.children = [
TypeError: can only concatenate list (not "Div") to list

which is caused by not inspecting the children argument before assigning it:

    def __init__(
        self, children: Any, open_details: bool = True, label: str = "", **kwargs: Any
    ) -> None:
        super().__init__(**kwargs)
        self.open = open_details
        self.children = [
            html.Summary(children=label, className="webviz-header")
        ] + children

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog 📝

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions