Skip to content

Conversation

@CaseMonster
Copy link
Contributor

Occasionally I've come across dropdowns that i need to cut off to a certain height to make them look good. This change adds a new property to Dropdown that adds an overflow and fixed height to allow the inner elements to be scrollable.

Default behavior is the same.

Adding only 'scroll' will add the overflow and a default max height.

Specifying scroll and max-height allows you to customize the height of the menu.

Screenshot 2025-10-28 130132 Screenshot 2025-10-28 130140 Screenshot 2025-10-28 130144

Occasionally I've come across dropdowns that i need to cut off to a certain height to make them look good.  This change adds a new property to Dropdown that adds an overflow and fixed height to allow the inner elements to be scrollable. 

Default behavior is the same.

Adding only 'scroll' will add the overflow and a default max height.  

Specifying scroll and max-height allows you to customize the height of the menu.
@CaseMonster
Copy link
Contributor Author

CaseMonster commented Oct 28, 2025

@php
    $array = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'];

@endphp

<x-card class="w-1/2 h-full">
    <div class="flex gap-4">

        <x-dropdown label="Normal Behavior" class="btn">
            @foreach ($array as $item)
                <x-menu-item title="Dropdown Item {{ $item }}" />
            @endforeach
        </x-dropdown>

        <x-dropdown label="Scrolling w/ Default Max Height" class="btn" scroll>
            @foreach ($array as $item)
                <x-menu-item title="Dropdown Item {{ $item }}" />
            @endforeach
        </x-dropdown>

        <x-dropdown label="Scrolling w/ max-h-64" class="btn" scroll max-height="max-h-64">
            @foreach ($array as $item)
                <x-menu-item title="Dropdown Item {{ $item }}" />
            @endforeach
        </x-dropdown>

    </div>
</x-card>

@robsontenorio robsontenorio changed the title Add scroll and maxHeight properties to Dropdown Dropdown: Add scroll and max-height properties Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant