bulma/docs/documentation/form/select.html

464 lines
10 KiB
HTML
Raw Normal View History

2017-07-17 18:17:57 +00:00
---
2017-07-29 12:02:00 +00:00
title: Select
2017-07-17 18:17:57 +00:00
layout: documentation
doc-tab: form
doc-subtab: select
2018-04-09 15:15:58 +00:00
breadcrumb:
- home
- documentation
- form
- form-select
meta:
colors: true
sizes: true
variables: false
2017-07-17 18:17:57 +00:00
---
{% capture select_example %}
<div class="select">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
{% endcapture %}
{% capture select_multiple_example %}
<div class="select is-multiple">
<select multiple size="8">
<option value="Argentina">Argentina</option>
<option value="Bolivia">Bolivia</option>
<option value="Brazil">Brazil</option>
<option value="Chile">Chile</option>
<option value="Colombia">Colombia</option>
<option value="Ecuador">Ecuador</option>
<option value="Guyana">Guyana</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Suriname">Suriname</option>
<option value="Uruguay">Uruguay</option>
<option value="Venezuela">Venezuela</option>
</select>
</div>
{% endcapture %}
{% capture colors_example %}
<div class="field">
<div class="control">
<div class="select is-primary">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-info">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-success">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-warning">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-danger">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
{% endcapture %}
2017-12-04 15:48:33 +00:00
{% capture rounded_example %}
<div class="select is-rounded">
<select>
<option>Rounded dropdown</option>
<option>With options</option>
</select>
</div>
{% endcapture %}
2017-07-17 18:17:57 +00:00
{% capture sizes_example %}
<div class="field">
<div class="control">
<div class="select is-small">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-medium">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<div class="select is-large">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
</div>
{% endcapture %}
{% capture normal_example %}
<div class="control">
<div class="select">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
{% endcapture %}
{% capture hover_example %}
<div class="control">
<div class="select">
<select class="is-hovered">
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
{% endcapture %}
{% capture focus_example %}
<div class="control">
<div class="select">
<select class="is-focused">
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
{% endcapture %}
{% capture loading_example %}
<div class="control">
<div class="select is-loading">
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
{% endcapture %}
{% capture disabled_example %}
<div class="control">
<div class="select is-disabled">
<select disabled>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
</div>
{% endcapture %}
{% capture icons_example %}
<div class="field">
<div class="control has-icons-left">
<div class="select">
<select>
<option selected>Country</option>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<div class="icon is-small is-left">
2018-01-10 16:30:23 +00:00
<i class="fas fa-globe"></i>
2017-07-17 18:17:57 +00:00
</div>
</div>
</div>
{% endcapture %}
{% capture has_icons_small_example %}
<div class="control has-icons-left">
<div class="select is-small">
<select>
<option selected>Country</option>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<span class="icon is-small is-left">
2018-01-10 16:30:23 +00:00
<i class="fas fa-globe"></i>
2017-07-17 18:17:57 +00:00
</span>
</div>
{% endcapture %}
{% capture has_icons_normal_example %}
<div class="control has-icons-left">
<div class="select">
<select>
<option selected>Country</option>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<span class="icon is-left">
2018-01-10 16:30:23 +00:00
<i class="fas fa-globe"></i>
2017-07-17 18:17:57 +00:00
</span>
</div>
{% endcapture %}
{% capture has_icons_medium_example %}
<div class="control has-icons-left">
<div class="select is-medium">
<select>
<option selected>Country</option>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<span class="icon is-medium is-left">
2018-01-10 16:30:23 +00:00
<i class="fas fa-globe"></i>
2017-07-17 18:17:57 +00:00
</span>
</div>
{% endcapture %}
{% capture has_icons_large_example %}
<div class="control has-icons-left">
<div class="select is-large">
<select>
<option selected>Country</option>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<span class="icon is-large is-left">
2018-01-10 16:30:23 +00:00
<i class="fas fa-globe"></i>
2017-07-17 18:17:57 +00:00
</span>
</div>
{% endcapture %}
2018-04-09 15:15:58 +00:00
<div class="content">
<p>The following <strong>modifiers</strong> are supported:</p>
<ul>
<li>the <strong><a href="#select-color">color</a></strong></li>
<li>the <strong><a href="#select-size">size</a></strong></li>
<li>the <strong><a href="#select-state">state</a></strong></li>
</ul>
</div>
<div class="columns">
<div class="column is-half">
{{select_example}}
</div>
<div class="column is-half highlight-full">
{% highlight html %}{{select_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<hr>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<h3 class="title">Multiple select</h3>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
2017-07-17 18:17:57 +00:00
<div class="content">
2018-04-09 15:15:58 +00:00
<p>
You can style a <strong>multiple select</strong> dropdown, by using the <code>is-multiple</code> modifier, and by using the <code>multiple</code> HTML attribute.
</p>
2017-07-17 18:17:57 +00:00
</div>
2018-04-09 15:15:58 +00:00
{{select_multiple_example}}
</div>
<div class="column is-half highlight-full">
{% highlight html %}{{select_multiple_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Colors" %}
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{colors_example}}
</div>
<div class="column is-half highlight-full">
{% highlight html %}{{colors_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Styles" %}
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
{% include elements/new-tag.html version="0.6.2" %}
2017-12-04 15:48:33 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{ rounded_example }}
</div>
<div class="column is-half">
{% highlight html %}{{ rounded_example }}{% endhighlight %}
</div>
</div>
2017-12-04 15:48:33 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Sizes" %}
2017-12-04 15:48:33 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{sizes_example}}
</div>
<div class="column is-half">
{% highlight html %}{{sizes_example}}{% endhighlight %}
</div>
</div>
2017-07-29 14:54:51 +00:00
2018-04-09 15:15:58 +00:00
<hr>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<h3 id="select-state" class="title">States</h3>
<h4 class="subtitle">Normal</h4>
<div class="columns">
<div class="column is-half">
{{normal_example}}
</div>
<div class="column is-half">
{% highlight html %}{{normal_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Hover</h4>
<div class="columns">
<div class="column is-half">
{{hover_example}}
</div>
<div class="column is-half">
{% highlight html %}{{hover_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Focus</h4>
<div class="columns">
<div class="column is-half">
{{focus_example}}
</div>
<div class="column is-half">
{% highlight html %}{{focus_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Loading</h4>
<div class="columns">
<div class="column is-half">
{{loading_example}}
</div>
<div class="column is-half">
{% highlight html %}{{loading_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<!-- Font Awesome Icons -->
<hr>
<h3 id="input-with-icons" class="title">With icons</h3>
<div class="content">
<p>You can append the <strong>modifier</strong> on a control:</p>
<ul>
<li>
<code>has-icons-left</code>
</li>
</ul>
<p>You also need to add a modifier on the <strong>icon</strong>:</p>
<ul>
<li>
<code>icon is-left</code> since <code>has-icons-left</code> is used
</li>
</ul>
<p>The size of the <strong>select</strong> will define the size of the icon container.</p>
</div>
<div class="columns">
<div class="column is-half">
{{icons_example}}
</div>
<div class="column is-half">
{% highlight html %}{{icons_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
2017-07-17 18:17:57 +00:00
<div class="content">
2018-04-09 15:15:58 +00:00
<p>
If the control contains an icon, Bulma will make sure the icon remains <strong>centered</strong>, no matter the size of the input <em>or</em> of the icon.
</p>
2017-07-17 18:17:57 +00:00
</div>
2018-04-09 15:15:58 +00:00
{{has_icons_small_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_small_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{has_icons_normal_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_normal_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{has_icons_medium_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_medium_example}}{% endhighlight %}
</div>
</div>
2017-07-17 18:17:57 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<div class="column is-half">
{{has_icons_large_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_large_example}}{% endhighlight %}
2017-07-17 18:17:57 +00:00
</div>
2018-04-09 15:15:58 +00:00
</div>