hub.eb?material_id=470&track_id=471

Responsive Bootstrap Dropdown


Bootstrap Dropdowns are useful for displaying lists dynamically. They are frequently used within navbars for presenting the user with links.

The Bootstrap Dropdown can be made to have responsive alignment at any breakpoint by giving the dropdown toggle element the custom attribute data-display="static" and one of the following classes:

  • dropdown-menu-{bp}-left
  • dropdown-menu-{bp}-right
  • dropdown-menu-{bp}-automatic
    • dropdown is aligned either right or left depending on available space.

You can find how to build a Bootstrap Dropdown here. 

Steps


1

Create a form with a Bootstrap4 Presentation Template. Ensure that the Presentation Template includes the Popper.js library. Otherwise, you can use the following CDN. 

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js

2

Create a Panel Control with the class dropdown.

3

Add a Button Control to the Panel Control with the id myButton, class dropdown-toggle and custom attributes:

data-toggle="dropdown", data-display="static", type="button"

4

Beneath the Button Control, create a Panel Control with id myDropdown and classes dropdown-menu and dropdown-menu-md-right

5

Add two Hyperlink Controls to the myDropdown Panel Control with content: Item A and Item B. Give each Hyperlink Control the class dropdown-item.

6

Run the form and observe the behaviour of the dropdown at different screen sizes.

Current Module

Related