2016-09-11 11:00:49 +00:00
---
layout: documentation
doc-tab: elements
doc-subtab: form
---
{% include subnav-elements.html %}
< section class = "section" >
< div class = "container" >
< h1 class = "title" > Form controls< / h1 >
< h2 class = "subtitle" >
All generic < strong > form controls< / strong > , designed for consistency
< / h2 >
< hr >
< div class = "content" >
< p > The following form controls < strong > classes< / strong > are supported:< / p >
< ul >
< li > < code > .label< / code > < / li >
< li > < code > .input< / code > < / li >
< li > < code > .textarea< / code > < / li >
< li > < code > .select< / code > < / li >
< li > < code > .checkbox< / code > < / li >
< li > < code > .radio< / code > < / li >
< li > < code > .button< / code > < / li >
< li > < code > .help< / code > < / li >
< / ul >
< p > When combining several controls in a < strong > form< / strong > , use the < code > .control< / code > class as a < strong > container< / strong > , to keep the spacing consistent.< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture form_example %}
2016-09-11 11:00:49 +00:00
< label class = "label" > Name< / label >
< p class = "control" >
< input class = "input" type = "text" placeholder = "Text input" >
< / p >
< label class = "label" > Username< / label >
< p class = "control has-icon has-icon-right" >
< input class = "input is-success" type = "text" placeholder = "Text input" value = "bulma" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-check" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< span class = "help is-success" > This username is available< / span >
< / p >
< label class = "label" > Email< / label >
< p class = "control has-icon has-icon-right" >
< input class = "input is-danger" type = "text" placeholder = "Email input" value = "hello@" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-warning" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< span class = "help is-danger" > This email is invalid< / span >
< / p >
< label class = "label" > Subject< / label >
< p class = "control" >
< span class = "select" >
< select >
< option > Select dropdown< / option >
< option > With options< / option >
< / select >
< / span >
< / p >
< label class = "label" > Message< / label >
< p class = "control" >
< textarea class = "textarea" placeholder = "Textarea" > < / textarea >
< / p >
< p class = "control" >
< label class = "checkbox" >
< input type = "checkbox" >
Remember me
< / label >
< / p >
< p class = "control" >
< label class = "radio" >
< input type = "radio" name = "question" >
Yes
< / label >
< label class = "radio" >
< input type = "radio" name = "question" >
No
< / label >
< / p >
2016-10-30 10:41:53 +00:00
< div class = "control is-grouped" >
< p class = "control" >
< button class = "button is-primary" > Submit< / button >
< / p >
< p class = "control" >
< button class = "button is-link" > Cancel< / button >
< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "columns" >
< div class = "column is-half" >
{{form_example}}
< / div >
< div class = "column is-half" >
{% highlight html %}
{{form_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< / div >
< / div >
< hr >
< h3 class = "title" > Colors< / h3 >
2016-10-30 14:59:46 +00:00
{% capture colors_example %}
2016-09-11 11:00:49 +00:00
< p class = "control" >
< input class = "input is-primary" type = "text" placeholder = "Primary input" >
< / p >
< p class = "control" >
< input class = "input is-info" type = "text" placeholder = "Info input" >
< / p >
< p class = "control" >
< input class = "input is-success" type = "text" placeholder = "Success input" >
< / p >
< p class = "control" >
< input class = "input is-warning" type = "text" placeholder = "Warning input" >
< / p >
< p class = "control" >
< input class = "input is-danger" type = "text" placeholder = "Danger input" >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "columns" >
< div class = "column is-half" >
{{colors_example}}
< / div >
< div class = "column is-half" >
{% highlight html %}
{{colors_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< / div >
< / div >
< hr >
2016-10-30 14:59:46 +00:00
{% capture sizes_example %}
2016-09-11 11:00:49 +00:00
< p class = "control" >
< input class = "input is-small" type = "text" placeholder = "Small input" >
< / p >
< p class = "control" >
< input class = "input" type = "text" placeholder = "Normal input" >
< / p >
< p class = "control" >
< input class = "input is-medium" type = "text" placeholder = "Medium input" >
< / p >
< p class = "control" >
< input class = "input is-large" type = "text" placeholder = "Large input" >
< / p >
2016-10-30 14:59:46 +00:00
< p class = "control" >
< span class = "select is-small" >
< select >
< option > Select dropdown< / option >
< option > With options< / option >
< / select >
< / span >
< / p >
< p class = "control" >
< span class = "select" >
< select >
< option > Select dropdown< / option >
< option > With options< / option >
< / select >
< / span >
< / p >
< p class = "control" >
< span class = "select is-medium" >
< select >
< option > Select dropdown< / option >
< option > With options< / option >
< / select >
< / span >
< / p >
< p class = "control" >
< span class = "select is-large" >
< select >
< option > Select dropdown< / option >
< option > With options< / option >
< / select >
< / span >
< / p >
{% endcapture %}
< h3 class = "title" > Sizes< / h3 >
< div class = "columns" >
< div class = "column is-half" >
{{sizes_example}}
< / div >
< div class = "column is-half" >
{% highlight html %}
{{sizes_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< / div >
< / div >
< hr >
< h3 class = "title" > States< / h3 >
2016-10-29 20:51:13 +00:00
< h4 class = "subtitle" > Normal< / h4 >
2016-10-30 14:59:46 +00:00
{% capture normal_example %}
2016-10-29 20:51:13 +00:00
< p class = "control" >
< input class = "input" type = "text" placeholder = "Normal input" >
< / p >
< p class = "control" >
< textarea class = "textarea" placeholder = "Normal textarea" > < / textarea >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-10-29 20:51:13 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{normal_example}}
2016-10-29 20:51:13 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{normal_example}}
{% endhighlight %}
< / div >
< / div >
< h4 class = "subtitle" > Hover< / h4 >
{% capture hover_example %}
2016-10-29 20:51:13 +00:00
< p class = "control" >
< input class = "input is-hovered" type = "text" placeholder = "Hovered input" >
< / p >
< p class = "control" >
< textarea class = "textarea is-hovered" placeholder = "Hovered textarea" > < / textarea >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-10-29 20:51:13 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{hover_example}}
2016-10-29 20:51:13 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{hover_example}}
{% endhighlight %}
< / div >
< / div >
< h4 class = "subtitle" > Focus< / h4 >
{% capture focus_example %}
2016-10-29 20:51:13 +00:00
< p class = "control" >
< input class = "input is-focused" type = "text" placeholder = "Focused input" >
< / p >
< p class = "control" >
< textarea class = "textarea is-focused" placeholder = "Focused textarea" > < / textarea >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-09-11 11:00:49 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{focus_example}}
2016-09-11 11:00:49 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{focus_example}}
{% endhighlight %}
< / div >
< / div >
< h4 class = "subtitle" > Loading< / h4 >
{% capture loading_example %}
2016-09-11 11:00:49 +00:00
< p class = "control is-loading" >
< input class = "input" type = "text" placeholder = "Loading input" >
< / p >
< p class = "control is-loading" >
< textarea class = "textarea" placeholder = "Loading textarea" > < / textarea >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-09-11 11:00:49 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{loading_example}}
2016-09-11 11:00:49 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{loading_example}}
{% endhighlight %}
< / div >
< / div >
< h4 class = "subtitle" > Disabled< / h4 >
{% capture disabled_example %}
2016-09-11 11:00:49 +00:00
< p class = "control" >
< input class = "input" type = "text" placeholder = "Disabled input" disabled >
< / p >
< p class = "control" >
< textarea class = "textarea" placeholder = "Disabled textarea" disabled > < / textarea >
< / p >
< p class = "control" >
< label class = "checkbox is-disabled" >
< input type = "checkbox" disabled >
Remember me
< / label >
< / p >
< p class = "control" >
< label class = "radio is-disabled" >
< input type = "radio" name = "question" disabled >
Yes
< / label >
< label class = "radio is-disabled" >
< input type = "radio" name = "question" disabled >
No
< / label >
< / p >
2016-10-30 10:41:53 +00:00
< div class = "control is-grouped" >
< p class = "control" >
< button class = "button is-primary" disabled > Submit< / button >
< / p >
< p class = "control" >
< button class = "button" disabled > Cancel< / button >
< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-09-11 11:00:49 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{disabled_example}}
2016-09-11 11:00:49 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{disabled_example}}
{% endhighlight %}
< / div >
< / div >
< h4 class = "subtitle" > With Font Awesome icons< / h4 >
{% capture icons_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-icon" >
< input class = "input" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-envelope" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon" >
< input class = "input" type = "password" placeholder = "Password" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-lock" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control" >
< button class = "button is-success" >
Login
< / button >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
2016-09-11 11:00:49 +00:00
< div class = "columns" >
< div class = "column is-half" >
2016-10-30 14:59:46 +00:00
{{icons_example}}
2016-09-11 11:00:49 +00:00
< / div >
< div class = "column is-half" >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{icons_example}}
{% endhighlight %}
< / div >
< / div >
{% capture icons_sizes_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-icon" >
< input class = "input is-small" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon is-small" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input" type = "email" placeholder = "Email" >
< span class = "icon is-small" >
< i class = "fa fa-envelope" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon" >
< input class = "input" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input is-medium" type = "email" placeholder = "Email" >
< span class = "icon is-small" >
< i class = "fa fa-envelope" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon" >
< input class = "input is-medium" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input is-medium" type = "email" placeholder = "Email" >
< span class = "icon is-medium" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input is-large" type = "email" placeholder = "Email" >
< span class = "icon is-small" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input is-large" type = "email" placeholder = "Email" >
< span class = "icon" >
< i class = "fa fa-envelope" > < / i >
< / span >
< / p >
< p class = "control has-icon" >
< input class = "input is-large" type = "email" placeholder = "Email" >
< span class = "icon is-medium" >
< i class = "fa fa-envelope" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon" >
< input class = "input is-large" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon is-large" >
< i class = "fa fa-envelope" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "columns" >
< div class = "column is-half" >
< div class = "content" >
< p >
< span class = "tag is-success" > New!< / span >
< / p >
< p >
If the control contains an icon, Bulma will make sure the button remains < strong > centered< / strong > , no matter the size of the input < em > or< / em > of the icon.
< / p >
< / div >
{{icons_sizes_example}}
< / div >
< div class = "column is-half" >
{% highlight html %}
{{icons_sizes_example}}
{% endhighlight %}
< / div >
< / div >
{% capture icons_sizes_right_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-icon has-icon-right" >
< input class = "input is-small" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon is-small" >
< i class = "fa fa-check" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon has-icon-right" >
< input class = "input" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon" >
< i class = "fa fa-check" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon has-icon-right" >
< input class = "input is-medium" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon is-medium" >
< i class = "fa fa-check" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
< p class = "control has-icon has-icon-right" >
< input class = "input is-large" type = "email" placeholder = "Email" >
2016-10-30 14:59:46 +00:00
< span class = "icon is-large" >
< i class = "fa fa-check" > < / i >
< / span >
2016-09-11 11:00:49 +00:00
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "columns" >
< div class = "column is-half" >
< div class = "content" >
< p >
By appending the < code > has-icon-right< / code > , the icon will be placed on the right side instead.
< / p >
2016-09-11 11:00:49 +00:00
< / div >
2016-10-30 14:59:46 +00:00
{{icons_sizes_right_example}}
< / div >
< div class = "column is-half" >
{% highlight html %}
{{icons_sizes_right_example}}
{% endhighlight %}
< / div >
< / div >
2016-09-11 11:00:49 +00:00
< hr >
< h3 class = "title" > Form addons< / h3 >
< div class = "content" >
< p > If you want to < strong > attach< / strong > controls together, use the < code > has-addons< / code > modifier on the < code > control< / code > container:< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture addons_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-addons" >
< input class = "input" type = "text" placeholder = "Find a repository" >
< a class = "button is-info" >
Search
< / a >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "example" >
{{addons_example}}
< / div >
{% highlight html %}
{{addons_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< div class = "content" >
< p > You can attach inputs, buttons, and dropdowns < strong > only< / strong > .< / p >
< p > Use the < code > is-expanded< / code > modifier on the element you want to fill up the remaing space (in this case, the input):< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture addons_expanded_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-addons" >
< span class = "select" >
< select >
< option > $< / option >
< option > £< / option >
< option > €< / option >
< / select >
< / span >
< input class = "input is-expanded" type = "text" placeholder = "Amount of money" >
2016-09-18 18:12:19 +00:00
< a class = "button" >
2016-09-11 11:00:49 +00:00
Transfer
< / a >
< / p >
< p class = "control has-addons" >
< span class = "select" >
< select >
< option > $< / option >
< option > £< / option >
< option > €< / option >
< / select >
< / span >
< input class = "input is-expanded" type = "text" placeholder = "Amount of money" >
2016-09-18 18:12:19 +00:00
< a class = "button" >
2016-09-11 11:00:49 +00:00
Transfer
< / a >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "example" >
{{addons_expanded_example}}
< / div >
{% highlight html %}
{{addons_expanded_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< div class = "content" >
< p > Use the < code > has-addons-centered< / code > or the < code > has-addons-right< / code > modifers to alter the < strong > alignment< / strong > .< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture addons_center_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-addons has-addons-centered" >
< span class = "select" >
< select >
< option > $< / option >
< option > £< / option >
< option > €< / option >
< / select >
< / span >
< input class = "input" type = "text" placeholder = "Amount of money" >
2016-09-18 18:12:19 +00:00
< a class = "button is-primary" >
2016-09-11 11:00:49 +00:00
Transfer
< / a >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "example" >
{{addons_center_example}}
2016-09-11 11:00:49 +00:00
< / div >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{addons_center_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
2016-10-30 14:59:46 +00:00
{% capture addons_right_example %}
2016-09-11 11:00:49 +00:00
< p class = "control has-addons has-addons-right" >
< span class = "select" >
< select >
< option > $< / option >
< option > £< / option >
< option > €< / option >
< / select >
< / span >
< input class = "input" type = "text" placeholder = "Amount of money" >
2016-09-18 18:12:19 +00:00
< a class = "button is-primary" >
2016-09-11 11:00:49 +00:00
Transfer
< / a >
< / p >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "example" >
{{addons_right_example}}
2016-09-11 11:00:49 +00:00
< / div >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{addons_right_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< hr >
< h3 class = "title" > Form group< / h3 >
< div class = "content" >
< p > If you want to < strong > group< / strong > controls together, use the < code > is-grouped< / code > modifier on the < code > control< / code > container:< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture group_example %}
2016-09-11 11:00:49 +00:00
< div class = "control is-grouped" >
< p class = "control is-expanded" >
< input class = "input" type = "text" placeholder = "Find a repository" >
< / p >
< p class = "control" >
< a class = "button is-info" >
Search
< / a >
< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% endcapture %}
< div class = "example" >
{{group_example}}
2016-09-11 11:00:49 +00:00
< / div >
{% highlight html %}
2016-10-30 14:59:46 +00:00
{{group_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< div class = "content" >
< p > Add the < code > is-expanded< / code > modifier on the control element you want to < strong > fill up the remaining space< / strong > .< / p >
< / div >
< hr >
< h3 class = "title" > Horizontal form< / h3 >
< div class = "content" >
< p > If you want a < strong > horizontal< / strong > form control, use the < code > is-horizontal< / code > modifier on the < code > control< / code > container, in which you include:< / p >
< ul >
< li >
< code > control-label< / code > for the side label
< / li >
< li >
< code > control< / code > for the input/select/textarea container
< / li >
< / ul >
< p > You can of course use < code > is-grouped< / code > or < code > has-addons< / code > for the child elements.< / p >
< / div >
2016-10-30 14:59:46 +00:00
{% capture horizontal_form_example %}
2016-09-11 11:00:49 +00:00
< div class = "control is-horizontal" >
< div class = "control-label" >
< label class = "label" > From< / label >
< / div >
< div class = "control is-grouped" >
< p class = "control is-expanded" >
< input class = "input" type = "text" placeholder = "Name" >
< / p >
< p class = "control is-expanded" >
< input class = "input" type = "email" placeholder = "Email" >
< / p >
< / div >
< / div >
< div class = "control is-horizontal" >
< div class = "control-label" >
< label class = "label" > Subject< / label >
< / div >
< div class = "control" >
< div class = "select is-fullwidth" >
< select >
< option > General enquiry< / option >
< / select >
< / div >
< / div >
< / div >
< div class = "control is-horizontal" >
< div class = "control-label" >
< label class = "label" > Question< / label >
< / div >
< div class = "control" >
< textarea class = "textarea" placeholder = "Explain how we can help you" > < / textarea >
< / div >
< / div >
2016-10-30 14:59:46 +00:00
{% endcapture %}
{{horizontal_form_example}}
{% highlight html %}
{{horizontal_form_example}}
2016-09-11 11:00:49 +00:00
{% endhighlight %}
< / div >
< / section >