2017-07-20 19:01:55 +00:00
|
|
|
---
|
2017-10-17 09:28:59 +00:00
|
|
|
title: Dropdown
|
2024-03-21 16:11:54 +00:00
|
|
|
layout: docs
|
|
|
|
theme: library
|
2017-07-20 19:01:55 +00:00
|
|
|
doc-tab: components
|
|
|
|
doc-subtab: dropdown
|
2018-04-09 12:18:46 +00:00
|
|
|
breadcrumb:
|
2024-03-21 16:11:54 +00:00
|
|
|
- home
|
|
|
|
- documentation
|
|
|
|
- components
|
|
|
|
- components-dropdown
|
2018-04-09 12:18:46 +00:00
|
|
|
meta:
|
2018-04-09 13:15:31 +00:00
|
|
|
colors: false
|
|
|
|
sizes: false
|
|
|
|
variables: true
|
2017-07-20 19:01:55 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
{% capture dropdown_example %}
|
2017-07-24 10:34:43 +00:00
|
|
|
<div class="dropdown is-active">
|
2017-07-21 09:44:49 +00:00
|
|
|
<div class="dropdown-trigger">
|
2017-07-26 17:45:08 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
|
2017-07-21 09:44:49 +00:00
|
|
|
<span>Dropdown button</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-21 09:44:49 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-21 09:44:49 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu" role="menu">
|
2017-07-21 09:44:49 +00:00
|
|
|
<div class="dropdown-content">
|
2024-03-21 16:11:54 +00:00
|
|
|
<a href="#" class="dropdown-item"> Dropdown item </a>
|
|
|
|
<a class="dropdown-item"> Other dropdown item </a>
|
|
|
|
<a href="#" class="dropdown-item is-active"> Active dropdown item </a>
|
|
|
|
<a href="#" class="dropdown-item"> Other dropdown item </a>
|
|
|
|
<hr class="dropdown-divider" />
|
|
|
|
<a href="#" class="dropdown-item"> With a divider </a>
|
2017-07-21 09:44:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_content_example %}
|
2017-07-24 10:34:43 +00:00
|
|
|
<div class="dropdown is-active">
|
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu2">
|
2017-07-24 10:34:43 +00:00
|
|
|
<span>Content</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-24 10:34:43 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-24 10:34:43 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu2" role="menu">
|
2017-07-24 10:34:43 +00:00
|
|
|
<div class="dropdown-content">
|
|
|
|
<div class="dropdown-item">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>
|
|
|
|
You can insert <strong>any type of content</strong> within the
|
|
|
|
dropdown menu.
|
|
|
|
</p>
|
2017-07-24 10:34:43 +00:00
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
<hr class="dropdown-divider" />
|
2017-07-24 10:34:43 +00:00
|
|
|
<div class="dropdown-item">
|
|
|
|
<p>You simply need to use a <code><div></code> instead.</p>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
<hr class="dropdown-divider" />
|
|
|
|
<a href="#" class="dropdown-item"> This is a link </a>
|
2017-07-24 10:34:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_click_example %}
|
2017-07-20 19:01:55 +00:00
|
|
|
<div class="dropdown">
|
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu3">
|
2017-07-20 19:01:55 +00:00
|
|
|
<span>Click me</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-20 19:01:55 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-20 19:01:55 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu3" role="menu">
|
2017-07-20 19:01:55 +00:00
|
|
|
<div class="dropdown-content">
|
2024-03-21 16:11:54 +00:00
|
|
|
<a href="#" class="dropdown-item"> Overview </a>
|
|
|
|
<a href="#" class="dropdown-item"> Modifiers </a>
|
|
|
|
<a href="#" class="dropdown-item"> Grid </a>
|
|
|
|
<a href="#" class="dropdown-item"> Form </a>
|
|
|
|
<a href="#" class="dropdown-item"> Elements </a>
|
|
|
|
<a href="#" class="dropdown-item"> Components </a>
|
|
|
|
<a href="#" class="dropdown-item"> Layout </a>
|
|
|
|
<hr class="dropdown-divider" />
|
|
|
|
<a href="#" class="dropdown-item"> More </a>
|
2017-07-20 19:01:55 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_info_example %}
|
2017-07-20 19:01:55 +00:00
|
|
|
<div class="dropdown is-hoverable">
|
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu4">
|
2017-07-20 19:01:55 +00:00
|
|
|
<span>Hover me</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-20 19:01:55 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-20 19:01:55 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu4" role="menu">
|
2017-07-20 19:01:55 +00:00
|
|
|
<div class="dropdown-content">
|
|
|
|
<div class="dropdown-item">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>
|
|
|
|
You can insert <strong>any type of content</strong> within the
|
|
|
|
dropdown menu.
|
|
|
|
</p>
|
2017-07-20 19:01:55 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_left_example %}
|
2017-07-24 10:54:00 +00:00
|
|
|
<div class="dropdown is-active">
|
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu5">
|
2017-07-24 10:54:00 +00:00
|
|
|
<span>Left aligned</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-24 10:54:00 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-24 10:54:00 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu5" role="menu">
|
2017-07-24 10:54:00 +00:00
|
|
|
<div class="dropdown-content">
|
|
|
|
<div class="dropdown-item">
|
|
|
|
<p>The dropdown is <strong>left-aligned</strong> by default.</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_right_example %}
|
2017-07-24 10:54:00 +00:00
|
|
|
<div class="dropdown is-right is-active">
|
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu6">
|
2017-07-24 10:54:00 +00:00
|
|
|
<span>Right aligned</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
2017-07-24 10:54:00 +00:00
|
|
|
</span>
|
2017-07-26 17:45:08 +00:00
|
|
|
</button>
|
2017-07-24 10:54:00 +00:00
|
|
|
</div>
|
2017-07-26 17:45:08 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu6" role="menu">
|
2017-07-24 10:54:00 +00:00
|
|
|
<div class="dropdown-content">
|
|
|
|
<div class="dropdown-item">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>
|
|
|
|
Add the <code>is-right</code> modifier for a
|
|
|
|
<strong>right-aligned</strong> dropdown.
|
|
|
|
</p>
|
2017-07-24 10:54:00 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{% endcapture %} {% capture dropdown_up_example %}
|
2017-10-09 09:36:14 +00:00
|
|
|
<div class="dropdown is-up">
|
2017-10-07 16:02:49 +00:00
|
|
|
<div class="dropdown-trigger">
|
2017-10-10 08:54:53 +00:00
|
|
|
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu7">
|
2017-10-07 16:02:49 +00:00
|
|
|
<span>Dropup button</span>
|
|
|
|
<span class="icon is-small">
|
2018-01-10 16:30:23 +00:00
|
|
|
<i class="fas fa-angle-up" aria-hidden="true"></i>
|
2017-10-07 16:02:49 +00:00
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="dropdown-menu" id="dropdown-menu7" role="menu">
|
|
|
|
<div class="dropdown-content">
|
|
|
|
<div class="dropdown-item">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>
|
|
|
|
You can add the <code>is-up</code> modifier to have a dropdown menu
|
|
|
|
that appears above the dropdown button.
|
|
|
|
</p>
|
2017-10-07 16:02:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endcapture %}
|
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
The <code>dropdown</code> component is a container for a dropdown button and
|
|
|
|
a dropdown menu.
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<code>dropdown</code> the <strong>main</strong> container
|
2017-07-21 09:44:49 +00:00
|
|
|
<ul>
|
|
|
|
<li>
|
2018-04-09 12:18:46 +00:00
|
|
|
<code>dropdown-trigger</code> the container for a <code>button</code>
|
|
|
|
</li>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>dropdown-menu</code> the toggable menu,
|
|
|
|
<strong>hidden</strong> by default
|
2017-07-21 09:44:49 +00:00
|
|
|
<ul>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>dropdown-content</code> the dropdown <strong>box</strong>,
|
|
|
|
with a white background and a shadow
|
2017-07-21 09:44:49 +00:00
|
|
|
<ul>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>dropdown-item</code> each
|
|
|
|
<strong>single item</strong> of the dropdown, which can either
|
|
|
|
be a <code>a</code> or a <code>div</code>
|
2018-04-09 12:18:46 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>dropdown-divider</code> a
|
|
|
|
<strong>horizontal line</strong> to separate dropdown items
|
2017-07-21 09:44:49 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2018-04-09 12:18:46 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2017-07-21 09:44:49 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=dropdown_example %} {% include
|
|
|
|
docs/elements/anchor.html name="Dropdown content" %}
|
2017-07-24 10:34:43 +00:00
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
While the <code>dropdown-item</code> can be used as an anchor link
|
|
|
|
<code><a></code>, you can also use a <code><div></code> and
|
|
|
|
insert almost <strong>any type of content</strong>.
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2017-07-24 10:34:43 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=dropdown_content_example %} {%
|
|
|
|
include docs/elements/anchor.html name="Hoverable or Toggable" %}
|
2017-07-24 10:34:43 +00:00
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
The <code>dropdown</code> component has
|
|
|
|
<strong>2 additional modifiers</strong>
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>is-hoverable</code>: the dropdown will show up when
|
|
|
|
<strong>hovering</strong> the <code>dropdown-trigger</code>
|
2018-04-09 12:18:46 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-03-21 16:11:54 +00:00
|
|
|
<code>is-active</code>: the dropdown will show up
|
|
|
|
<strong>all the time</strong>
|
2018-04-09 12:18:46 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2017-07-24 10:34:43 +00:00
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="message is-success">
|
|
|
|
<p class="message-body">
|
2024-03-21 16:11:54 +00:00
|
|
|
While the CSS <code>:hover</code> implementation works perfectly, the
|
|
|
|
<code>is-active</code> class is available for users who want to control the
|
|
|
|
display of the dropdown with <strong>JavaScript</strong>.
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2017-07-24 10:34:43 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=dropdown_click_example more=true
|
|
|
|
%} {% include docs/elements/snippet.html content=dropdown_info_example more=true
|
|
|
|
%} {% include docs/elements/anchor.html name="Right aligned" %}
|
2017-07-24 10:54:00 +00:00
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
You can add the <code>is-right</code> modifier to have a
|
|
|
|
<strong>right-aligned</strong> dropdown.
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2017-07-24 10:54:00 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=dropdown_left_example more=true %}
|
|
|
|
{% include docs/elements/snippet.html content=dropdown_right_example more=true
|
|
|
|
%} {% include docs/elements/anchor.html name="Dropup" %}
|
2017-10-07 16:02:49 +00:00
|
|
|
|
2018-04-09 12:18:46 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
You can add the <code>is-up</code> modifier to have a dropdown menu that
|
|
|
|
appears above the dropdown button.
|
2018-04-09 12:18:46 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2017-07-28 22:27:59 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=dropdown_up_example more=true %}
|
2018-04-09 12:18:46 +00:00
|
|
|
|