Collapsible

collapsible

A collapsible element is a user interface component that allows content to be expanded or collapsed, providing a way to hide and reveal sections of content. This is particularly useful for managing large amounts of information, improving navigation, and creating a more organized layout. Common use cases include FAQs, accordion menus (which has it’s own component), and hiding additional details that can be shown on demand. This documentation provides instructions on how to implement and customize the collapsible component.

Arguments

title
Specifies the title of the collapsible element. If a post is provided, this defaults to the post title.
content
Defines the content to be displayed within the collapsible element. If a post is provided, this defaults to the post content.
children
Specifies any child elements that are part of the collapsible element.
open
Indicates whether the collapsible element should be open by default.
post
When specified, uses the title and content of the provided post for the collapsible element as default.

Sample

A simple implementation of the component
The collapsible content goes here
echo fuse( 'collapsible', array(
    'title' => 'Collapsible title',
    'content' => 'The collapsible content goes here'
) );
Proving post id is a shorthand for specifying title and content.

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

echo fuse( 'collapsible', array(
    'post' => 28,
    'open' => true
) );