Skip to content

Feature Request: Option to prevent side panel auto-opening for display="side" elements #2932

@codiak

Description

@codiak

Feature Request

Description

When using CustomElement (or other elements) with display="side", the side panel automatically opens every time an element is added to a message. This can be disruptive UX when users have intentionally closed the panel and send another message — the panel reopens on each response.

Current Behavior

sources_element = cl.CustomElement(
    name="Sources",
    props={"items": sources},
    display="side",
)

Every time a message with this element is sent, the side panel opens automatically, even if the user previously closed it.

Desired Behavior

Add an option to control whether the side panel auto-opens, for example:

sources_element = cl.CustomElement(
    name="Sources",
    props={"items": sources},
    display="side",
    auto_expand=False,  # New parameter - default True to preserve current behavior
)

Or a config option in config.toml:

[UI]
auto_expand_side_elements = false

Use Case

In our chat application, we attach sources to every assistant response. Users who prefer to focus on the conversation find it annoying that the sources panel keeps reopening after each message, requiring them to close it repeatedly.

Environment

  • Chainlit version: 2.11.1
  • Python version: 3.12

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions