Articles in this section
Category / Section

Adding scrollable Dropdown Menu to Syncfusion Blazor - CSS implementation.

2 mins read

Introduction

In web applications, dropdown menus are a common component that can enhance navigation and functionality. Syncfusion Blazor Dropdown Menucomponents offer a wide range of UI elements that can be customized to fit the needs of any application. In this article, we will demonstrate how to add a scrollable dropdown menu to a Syncfusion Blazor component using CSS.

Adding a Scrollable Dropdown Menu

To create a scrollable dropdown menu in a Syncfusion Blazor component, you can use the SfDropDownButton component and customize its appearance with CSS. Below is a code snippet that shows how to implement a scrollable dropdown menu:

<SfDropDownButton CssClass="e-custom" Content="Edit">
    <DropDownMenuItems>
        <DropDownMenuItem Text="Cut"></DropDownMenuItem>
        <DropDownMenuItem Text="Copy"></DropDownMenuItem>
        <DropDownMenuItem Text="Paste"></DropDownMenuItem>
        <DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
        <DropDownMenuItem Text="Notifications"></DropDownMenuItem>
        <DropDownMenuItem Text="User Settings"></DropDownMenuItem>
        <DropDownMenuItem Text="Log Out"></DropDownMenuItem>
        <DropDownMenuItem Text="Delete"></DropDownMenuItem>
        <DropDownMenuItem Text="Align"></DropDownMenuItem>
        <DropDownMenuItem Text="Left"></DropDownMenuItem>
    </DropDownMenuItems>
</SfDropDownButton>

<style>
    .e-custom.e-dropdown-popup ul {
        height: 150px;
        overflow: auto;
    }
</style>

The CSS class .e-custom.e-dropdown-popup ul targets the unordered list within the dropdown popup. By setting a fixed height and the overflow property to auto, you enable scrolling within the dropdown when the content exceeds the specified height.

Example

To see a live example of a scrollable dropdown menu using Syncfusion Blazor components, you can visit the following sample link:

Syncfusion Blazor Playground - Scrollable Dropdown Menu

Conclusion

By following the steps outlined in this article, you can easily add a scrollable dropdown menu to your Syncfusion Blazor components. This feature is particularly useful when dealing with a long list of menu items, ensuring a clean and user-friendly interface.

Additional References

For more information on Syncfusion Blazor components and customization options, please refer to the following resources:

Remember to explore the Syncfusion documentation for more tips and tricks on enhancing your Blazor applications with rich UI components.

Conclusion

I hope you enjoyed learning about adding scrollable Dropdown Menu to Syncfusion Blazor - CSS implementation.

You can refer to our Blazor Dropdown Menu feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor Dropdown Menu example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied