Components

Collapse

Collapsible sections allow to toggle content visibility, perfect for compact organization.

Usage

The collapse component is useful for organizing large amounts of information in a compact way.

  • src
    • app
    • pages
    • components
@using LumexUI.Shared.Icons

<ul class="min-w-48">
    <li>
        <div class="@_directoryStyles" @onclick="@(() => _expanded = !_expanded)">
            @(_expanded ? @<FolderOpenIcon /> : @<FolderIcon />)
            <span>src</span>
        </div>
        <LumexCollapse As="ul" Expanded="@_expanded" Class="ml-4">
            @foreach( var dir in new[] { "app", "pages", "components" } )
            {
                <li class="@_directoryStyles">
                    <FolderIcon />
                    <span>@dir</span>
                </li>
            }
        </LumexCollapse>
    </li>
</ul>

@code {
    private bool _expanded = true;

    private string _directoryStyles = new ElementClass()
        .Add( "flex" )
        .Add( "items-center" )
        .Add( "gap-2" )
        .Add( "px-2" )
        .Add( "py-1" )
        .Add( "py-1" )
        .Add( "rounded-medium" )
        .Add( "cursor-pointer" )
        .Add( "hover:bg-indigo-50" )
        .Add( "hover:text-indigo-600" )
        .Add( "dark:hover:bg-indigo-500/15" )
        .Add( "dark:hover:text-indigo-200" );
}

Custom Styles

You can customize the collapse component by passing any Tailwind CSS classes to the component's Class parameter.

API

See the API references below for a complete guide to all the parameters available for the components mentioned here.

An unhandled error has occurred. Reload 🗙