Components

Popover

Popovers display additional content that floats near its trigger element.

Composition

This component is a composition of 2 key components:

  • LumexPopover: A component representing the popover that displays additional content within a floating container.
  • LumexPopoverContent: A component representing the content of the popover.

Usage

The popover component provides a simple floating container for contextual information or actions.

<LumexPopover>
    <LumexPopoverTrigger>
        <LumexButton>Open Popover</LumexButton>
    </LumexPopoverTrigger>
    <LumexPopoverContent>
        <div class="px-1 py-2">
            <div class="text-small font-bold">Oh, hi there!</div>
            <div class="text-tiny">I am the popover content</div>
        </div>
    </LumexPopoverContent>
</LumexPopover>

Colors

You can customize the background color of the popover to match your theme or highlight important content.

@using LumexUI.Services

@foreach( var color in Enum.GetValues<ThemeColor>()[1..] )
{
    <LumexPopover Color="@color">
        <LumexPopoverTrigger>
            <LumexButton>@color.ToString()</LumexButton>
        </LumexPopoverTrigger>
        <LumexPopoverContent>
            <div class="px-1 py-2">
                <div class="text-small font-bold">Oh, hi there!</div>
                <div class="text-tiny">I am the popover content</div>
            </div>
        </LumexPopoverContent>
    </LumexPopover>
}

Sizes

Adjust the font size of the popover to scale text for readability and emphasis.

@using LumexUI.Services

@foreach( var size in Enum.GetValues<Size>() )
{
    <LumexPopover Size="@size">
        <LumexPopoverTrigger>
            <LumexButton Color="@ThemeColor.Primary"
                         Variant="@Variant.Flat">
                @size.ToString()
            </LumexButton>
        </LumexPopoverTrigger>
        <LumexPopoverContent>
            <div class="px-1 py-2">
                <div class="text-small font-bold">Oh, hi there!</div>
                <div>I am the popover content</div>
            </div>
        </LumexPopoverContent>
    </LumexPopover>
}

Radius

The Radius parameter allows you to set the border radius, creating rounded or square corners for the popover.

@using LumexUI.Services

@foreach( var radius in Enum.GetValues<Radius>() )
{
    <LumexPopover Radius="@radius">
        <LumexPopoverTrigger>
            <LumexButton Color="@ThemeColor.Secondary"
                         Variant="@Variant.Flat">
                @radius.ToString()
            </LumexButton>
        </LumexPopoverTrigger>
        <LumexPopoverContent>
            <div class="px-1 py-2">
                <div class="text-small font-bold">Oh, hi there!</div>
                <div class="text-tiny">I am the popover content</div>
            </div>
        </LumexPopoverContent>
    </LumexPopover>
}

Shadows

Adjust a shadow effect to the popover for a more elevated, visually distinct appearance.

@using LumexUI.Services

@foreach( var shadow in Enum.GetValues<Shadow>() )
{
    <LumexPopover Shadow="@shadow">
        <LumexPopoverTrigger>
            <LumexButton Color="@ThemeColor.Success"
                         Variant="@Variant.Flat">
                @shadow.ToString()
            </LumexButton>
        </LumexPopoverTrigger>
        <LumexPopoverContent>
            <div class="px-1 py-2">
                <div class="text-small font-bold">Oh, hi there!</div>
                <div>I am the popover content</div>
            </div>
        </LumexPopoverContent>
    </LumexPopover>
}

Placements

Specify the position of the popover relative to the trigger element, with options like Right, Left, TopStart, and more.

@using LumexUI.Services

<div class="flex flex-wrap md:inline-grid md:grid-cols-3 gap-4">
    @foreach( var placement in Enum.GetValues<PopoverPlacement>() )
    {
        <LumexPopover Placement="@placement">
            <LumexPopoverTrigger>
                <LumexButton Color="@ThemeColor.Danger"
                             Variant="@Variant.Flat"
                             Class="capitalize">
                    @placement.ToDescription().Replace( "-", " " )
                </LumexButton>
            </LumexPopoverTrigger>
            <LumexPopoverContent>
                <div class="px-1 py-2">
                    <div class="text-small font-bold">Oh, hi there!</div>
                    <div class="text-tiny">I am the popover content</div>
                </div>
            </LumexPopoverContent>
        </LumexPopover>
    }
</div>

Offset

Set an offset to adjust the distance between the popover and its trigger element for finer control over placement.

@using LumexUI.Services

<LumexPopover Offset="16">
    <LumexPopoverTrigger>
        <LumexButton>Open Popover</LumexButton>
    </LumexPopoverTrigger>
    <LumexPopoverContent>
        <div class="px-1 py-2">
            <div class="text-small font-bold">Oh, hi there!</div>
            <div class="text-tiny">I am the popover content</div>
        </div>
    </LumexPopoverContent>
</LumexPopover>

Arrow

Enable an arrow on the popover to visually connect it to its trigger element, making the source of information clearer.

@using LumexUI.Services

<LumexPopover ShowArrow="@true">
    <LumexPopoverTrigger>
        <LumexButton>Open Popover</LumexButton>
    </LumexPopoverTrigger>
    <LumexPopoverContent>
        <div class="px-1 py-2">
            <div class="text-small font-bold">Oh, hi there!</div>
            <div class="text-tiny">I am the popover content</div>
        </div>
    </LumexPopoverContent>
</LumexPopover>

Custom styles

This component supports named slots, which allow custom styles to be applied to specific parts of the component:

  • Base: The overall container of the popover.
  • Content: The container of the popover content.
  • Arrow: The arrow element that connects the popover to its trigger element.

You can customize the component(s) by passing any Tailwind CSS classes to the following component parameters:

Popover

  • Class: The CSS class name that styles the wrapper of the popover.
  • Classes: The CSS class names for the popover slots that style entire popover.
@using LumexUI.Services

<LumexPopover Offset="16"
              ShowArrow="@true"
              Placement="@PopoverPlacement.Right"       
              Classes="@_classes">
    <LumexPopoverTrigger>
        <LumexButton>Open Popover</LumexButton>
    </LumexPopoverTrigger>
    <LumexPopoverContent>
        <div class="px-1 py-2">
            <h3 class="text-small font-bold">Oh, hi there!</h3>
            <div class="text-tiny">I am the popover content</div>
        </div>
    </LumexPopoverContent>
</LumexPopover>

@code {
    private PopoverSlots _classes = new()
    {
        Content = ElementClass.Empty()
            .Add( "py-3 px-4 border border-default-200" )
            .Add( "bg-linear-to-br from-white to-default-200" )
            .Add( "dark:from-default-100 dark:to-default-50" )
            .ToString(),
        Arrow = "bg-default-200"
    };
}

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 🗙