Form controls
All generic form controls, designed for consistency
The following form controls classes are supported:
.label
.input
.textarea
.select
.checkbox
.radio
.button
.help
Each of them should be wrapped in a .control
container.
When combining several controls in a form, use the .field
class as a container, to keep the spacing consistent.
{{example}}
{% highlight html %}{{example}}{% endhighlight %}
The field
container is a simple container for:
- a text
label
- a form
control
- an optional
help
text
It allows form fields to be spaced consistently.
{{field_example}}
{% highlight html %}{{field_example}}{% endhighlight %}
This container allows form fields to be spaced consistently.
{{fields_example}}
{% highlight html %}{{fields_example}}{% endhighlight %}
The control
is a versatile container meant to enhance single form controls. Because it has the same height as a control elements, It can only contain the following elements:
{{control_input_example}}
{% highlight html %}{{control_input_example}}{% endhighlight %}
{{control_select_example}}
{% highlight html %}{{control_select_example}}{% endhighlight %}
{{control_button_example}}
{% highlight html %}{{control_button_example}}{% endhighlight %}
If you want to attach controls together, use the has-addons
modifier on the field
container:
{{addons_example}}
{% highlight html %}{{addons_example}}{% endhighlight %}
You can attach inputs, buttons, and dropdowns only.
New!
0.4.2
It can be useful to append a static button.
{{addons_static_example}}
{% highlight html %}{{addons_static_example}}{% endhighlight %}
Use the is-expanded
modifier on the element you want to fill up the remaining space (in this case, the input):
{{addons_expanded_example}}
{% highlight html %}{{addons_expanded_example}}{% endhighlight %}
If you want a full width select dropdown, pair control is-expanded
with select is-fullwidth
.
{{addons_expanded_fullwidth_example}}
{% highlight html %}{{addons_expanded_fullwidth_example}}{% endhighlight %}
Use the has-addons-centered
or the has-addons-right
modifers to alter the alignment.
{{addons_center_example}}
{% highlight html %}{{addons_center_example}}{% endhighlight %}
{{addons_right_example}}
{% highlight html %}{{addons_right_example}}{% endhighlight %}
Form group
If you want to group controls together, use the is-grouped
modifier on the field
container.
Use the is-grouped-centered
or the is-grouped-right
modifers to alter the alignment.
Add the is-expanded
modifier on the control element you want to fill up the remaining space with.
{{group_example}}
{% highlight html %}{{group_example}}{% endhighlight %}
Horizontal form
If you want a horizontal form control, use the is-horizontal
modifier on the field
container, in which you include:
-
field-label
for the side label
-
field-body
for the input/select/textarea container
You can use is-grouped
or has-addons
for the child elements.
{{horizontal_form_example}}
{% highlight html %}{{horizontal_form_example}}{% endhighlight %}
To preserve the vertical alignment of labels with each type and size of control, the .field-label
comes with 4 size modifiers:
-
.is-small
-
.is-normal
for any .input
or .button
-
.is-medium
-
.is-large
{{field_label_example}}
{% highlight html %}{{field_label_example}}{% endhighlight %}