Skip to content

[Bug]: Clarify Collapse component content wrapper requirements in documentation #6255

@jacekmichalski

Description

@jacekmichalski

https://blazorise.com/docs/components/collapse

Description

The Collapse component documentation should explicitly clarify that content must be wrapped in <CollapseBody>, not <ChildContent> or placed directly inside <Collapse>.

Current Situation

When implementing a Collapse component, it's not immediately clear from the documentation what the correct content wrapper should be. This can lead developers to try incorrect patterns like:

<!-- ❌ Incorrect - doesn't work -->
<Collapse @bind-Visible="isVisible">
    <ChildContent>
        <!-- content here -->
    </ChildContent>
</Collapse>

<!-- ❌ Incorrect - doesn't work -->
<Collapse @bind-Visible="isVisible">
    <!-- content directly here -->
</Collapse>
The correct implementation requires <CollapseBody>:
<!-- ✅ Correct -->
<Collapse @bind-Visible="isVisible">
    <CollapseBody>
        <!-- content here -->
    </CollapseBody>
</Collapse>

Suggested Improvement

Add a prominent note in the Collapse component documentation stating:
Important: Content inside a Collapse component must be wrapped in a element.
Include the basic usage example showing the wrapper in the first code example
Add a "Common Mistakes" section showing incorrect patterns and why they don't work
Update the API documentation to list as a required child component

Impact

This would help developers avoid spending time debugging why their Collapse component isn't working when the state changes but the content doesn't collapse/expand.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

🔙 Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions