Bulma Dropdown Variables

Last Updated : 23 Jul, 2025

Bulma is a component-rich, modern, and lightweight CSS framework that is based on flexbox. It helps in building beautiful and responsive web interfaces easier and faster. In this article, we will be seeing what type of content can be used inside a dropdown component in Bulma.

So, an HTML <a> tag can be used directly as a dropdown item but we can also use an HTML <div> element as a dropdown item and fill the div element with whatever content we like. For example paragraphs, links, buttons, etc.

Variable Used:

Variable-NameDescriptionTypeValueComputed Value  Computed Type 
$dropdown-menu-min-widthThis variable is used to provide the minimum width of the dropdown menu.size                       12rem  
$dropdown-content-background-colorThis variable is used to provide the background color to the content of the dropdown.variable
 
$scheme-mainhsl(0, 0%, 100%)color
$dropdown-content-arrowThis variable is used to provide an arrow to the content of the dropdown.$variable
 
$linkhsl(229, 53%,  53%)color
$dropdown-content-offsetThis variable is used to provide an offset to the content of the dropdown.size4px  
$dropdown-content-padding-bottomThis variable is used to provide bottom padding to the content of the dropdown.size0.5rem  
$dropdown-content-padding-topThis variable is used to provide top padding to the content of the dropdown.size0.5rem  
$dropdown-content-radiusThis variable is used to provide a radius to the content of the dropdown.variable$radius4pxsize
$dropdown-content-shadowThis variable is used to provide a shadow to the content of the dropdown.variable$shadow0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02)shadow
 
$dropdown-content-zThis variable is used to provide an index to the content of the dropdown.string20  
$dropdown-item-colorThis variable is used to provide color to the item of the dropdown.variable$texthsl(0, 0%, 29%)color
$dropdown-item-hover-colorThis variable is used to provide the hover effect to the item of the dropdown.variable$scheme-inverthsl(0, 0%, 4%)color
$dropdown-item-hover-background-colorThis variable is used to provide background color to the hover effect in the dropdown.variable$backgroundhsl(0, 0%, 96%)color
$dropdown-item-active-colorThis variable is used to provide color to the active item of the dropdown.variable$link-invert#fffcolor
$dropdown-item-active-background-colorThis variable is used to provide the background color to the active dropdown item.variable$linkhsl(229, 53%,  53%)color
$dropdown-divider-background-colorThis variable is used to provide background color to the divider of the dropdown.variable$border-lighthsl(0, 0%, 93%)color

Example 1: In the below code, we will make use of the above variable to modify the dropdown menu.

HTML
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content=
        "width=device-width,initial-scale=1">
    <link rel="stylesheet" href=
"https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
    <link rel="stylesheet" href="style.css">
    <title>Bulma Variable</title>
</head>

<body>
    <center>
        <h1 class="title" style="color:green;" >
            GeeksforGeeks
        </h1>        
        <h3 class="subtitle">
            A computer science portal for geeks
        </h3>
    
        <div class='container has-text-centered'>
            <div class='columns is-mobile is-centered'>
                <div class='column is-5'>
                    <div class="dropdown is-active">
                        <div class="dropdown-trigger">
                            <button class="button"
                                    aria-haspopup="true"
                                    aria-controls="dropdown-menu">
                                <span>Language</span>
                                <span class="icon is-small">
                                    <i class="fas fa-angle-down" 
                                       aria-hidden="true">
                                    </i>
                                </span>
                            </button>
                        </div>
                
                        <div class="dropdown-menu" id="dropdown-menu" 
                             role="menu">
                            <div class="dropdown-content">
                                <a href="#" class="dropdown-item">
                                    C++
                                </a>                        
                                <a href="#" class="dropdown-item">
                                    JAVA
                                </a>                        
                                <a href="#" class="dropdown-item">
                                    C
                                </a>                        
                                <a href="#" class="dropdown-item">
                                    Python
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>        
    </center>
</body>
</html>

SCSS Code:

$dropdown-content-background-color: lightgreen;
a {
   background-color:$dropdown-content-background-color;
}

Compiled CSS Code:

a {
 background-color: lightgreen;
}

Output:

 

Example 2: In the below code, we will make use of the above variable to modify the dropdown menu.

HTML
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content=
        "width=device-width,initial-scale=1">
    <link rel="stylesheet" href=
"https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
    <link rel="stylesheet" href="style.css">
    <title>Bulma Variable</title>
</head>

<body>
    <center>
        <h1 class="title" style="color:green;" >
            GeeksforGeeks
        </h1>        
        <h3 class="subtitle">
            A computer science portal for geeks
        </h3>
    
        <div class='container has-text-centered'>
            <div class='columns is-mobile is-centered'>
                <div class='column is-5'>
                    <div class="dropdown is-active">
                        <div class="dropdown-trigger">
                            <button class="button" aria-haspopup="true"
                                    aria-controls="dropdown-menu">
                                <span>Language</span>
                                <span class="icon is-small">
                                    <i class="fas fa-angle-down" 
                                       aria-hidden="true"></i>
                                </span>
                            </button>
                        </div>
            
                        <div class="dropdown-menu" id="dropdown-menu" 
                             role="menu">
                            <div class="dropdown-content">
                                <a href="#" class="dropdown-item">
                                    C++
                                </a>                            
                                <a href="#" class="dropdown-item">
                                    JAVA
                                </a>                            
                                <a href="#" class="dropdown-item">
                                    C
                                </a>                            
                                <a href="#" class="dropdown-item">
                                    Python
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>        
    </center>
</body>
</html>

SCSS Code:

$dropdown-item-color: green;
.dropdown-item {
   color:$dropdown-item-color;
}

Compiled CSS Code:

.dropdown-item {
  color: green;
}

Output:

 

Reference: https://bulma.io/documentation/components/dropdown/#variables

Comment