This commit is contained in:
Jeremy Thomas
2024-03-21 16:11:54 +00:00
parent 16f1b76881
commit 69877a652c
3261 changed files with 255369 additions and 108913 deletions

View File

@@ -1,104 +1,107 @@
---
title: Input
layout: documentation
layout: docs
theme: library
doc-tab: form
doc-subtab: input
breadcrumb:
- home
- documentation
- form
- form-input
- home
- documentation
- form
- form-input
variables_keys:
- $input-color
- $input-background-color
- $input-border-color
- $input-shadow
- $input-hover-color
- $input-hover-border-color
- $input-focus-color
- $input-focus-border-color
- $input-focus-box-shadow-size
- $input-focus-box-shadow-color
- $input-disabled-color
- $input-disabled-background-color
- $input-disabled-border-color
- $input-arrow
- $input-icon-color
- $input-icon-active-color
- $input-radius
- $input-color
- $input-background-color
- $input-border-color
- $input-shadow
- $input-hover-color
- $input-hover-border-color
- $input-focus-color
- $input-focus-border-color
- $input-focus-box-shadow-size
- $input-focus-box-shadow-color
- $input-disabled-color
- $input-disabled-background-color
- $input-disabled-border-color
- $input-arrow
- $input-icon-color
- $input-icon-active-color
- $input-radius
meta:
colors: true
sizes: true
variables: true
---
{% capture input_example %}
<input class="input" type="text" placeholder="Text input">
<input class="input" type="text" placeholder="Text input" />
{% endcapture %}
{% capture rounded_example %}
<input class="input is-rounded" type="text" placeholder="Rounded input">
<input class="input is-rounded" type="text" placeholder="Rounded input" />
{% endcapture %}
{% capture normal_example %}
<div class="control">
<input class="input" type="text" placeholder="Normal input">
<input class="input" type="text" placeholder="Normal input" />
</div>
{% endcapture %}
{% capture hover_example %}
<div class="control">
<input class="input is-hovered" type="text" placeholder="Hovered input">
<input class="input is-hovered" type="text" placeholder="Hovered input" />
</div>
{% endcapture %}
{% capture focus_example %}
<div class="control">
<input class="input is-focused" type="text" placeholder="Focused input">
<input class="input is-focused" type="text" placeholder="Focused input" />
</div>
{% endcapture %}
{% capture loading_example %}
<div class="control is-loading">
<input class="input" type="text" placeholder="Loading input">
<input class="input" type="text" placeholder="Loading input" />
</div>
{% endcapture %}
{% capture loading_sizes_example %}
<div class="field">
<div class="control is-small is-loading">
<input class="input is-small" type="text" placeholder="Small loading input">
<input
class="input is-small"
type="text"
placeholder="Small loading input"
/>
</div>
</div>
<div class="field">
<div class="control is-loading">
<input class="input" type="text" placeholder="Normal loading input">
<input class="input" type="text" placeholder="Normal loading input" />
</div>
</div>
<div class="field">
<div class="control is-medium is-loading">
<input class="input is-medium" type="text" placeholder="Medium loading input">
<input
class="input is-medium"
type="text"
placeholder="Medium loading input"
/>
</div>
</div>
<div class="field">
<div class="control is-large is-loading">
<input class="input is-large" type="text" placeholder="Large loading input">
<input
class="input is-large"
type="text"
placeholder="Large loading input"
/>
</div>
</div>
{% endcapture %}
{% capture disabled_example %}
<div class="control">
<input class="input" type="text" placeholder="Disabled input" disabled>
<input class="input" type="text" placeholder="Disabled input" disabled />
</div>
{% endcapture %}
{% capture readonly_example %}
<div class="control">
<input class="input" type="text" value="This text is readonly" readonly>
<input class="input" type="text" value="This text is readonly" readonly />
</div>
{% endcapture %}
{% capture static_example %}
<div class="field is-horizontal">
<div class="field-label is-normal">
@@ -107,7 +110,12 @@ meta:
<div class="field-body">
<div class="field">
<p class="control">
<input class="input is-static" type="email" value="me@example.com" readonly>
<input
class="input is-static"
type="email"
value="me@example.com"
readonly
/>
</p>
</div>
</div>
@@ -120,17 +128,16 @@ meta:
<div class="field-body">
<div class="field">
<p class="control">
<input class="input" type="email" placeholder="Recipient email">
<input class="input" type="email" placeholder="Recipient email" />
</p>
</div>
</div>
</div>
{% endcapture %}
{% capture icons_example %}
<div class="field">
<p class="control has-icons-left has-icons-right">
<input class="input" type="email" placeholder="Email">
<input class="input" type="email" placeholder="Email" />
<span class="icon is-small is-left">
<i class="fas fa-envelope"></i>
</span>
@@ -141,17 +148,16 @@ meta:
</div>
<div class="field">
<p class="control has-icons-left">
<input class="input" type="password" placeholder="Password">
<input class="input" type="password" placeholder="Password" />
<span class="icon is-small is-left">
<i class="fas fa-lock"></i>
</span>
</p>
</div>
{% endcapture %}
{% capture has_icons_small_example %}
<div class="control has-icons-left has-icons-right">
<input class="input is-small" type="email" placeholder="Email">
<input class="input is-small" type="email" placeholder="Email" />
<span class="icon is-small is-left">
<i class="fas fa-envelope"></i>
</span>
@@ -160,10 +166,9 @@ meta:
</span>
</div>
{% endcapture %}
{% capture has_icons_normal_example %}
<div class="control has-icons-left has-icons-right">
<input class="input" type="email" placeholder="Email">
<input class="input" type="email" placeholder="Email" />
<span class="icon is-small is-left">
<i class="fas fa-envelope"></i>
</span>
@@ -172,10 +177,9 @@ meta:
</span>
</div>
{% endcapture %}
{% capture has_icons_medium_example %}
<div class="control has-icons-left has-icons-right">
<input class="input is-medium" type="email" placeholder="Email">
<input class="input is-medium" type="email" placeholder="Email" />
<span class="icon is-left">
<i class="fas fa-envelope"></i>
</span>
@@ -184,10 +188,9 @@ meta:
</span>
</div>
{% endcapture %}
{% capture has_icons_large_example %}
<div class="control has-icons-left has-icons-right">
<input class="input is-large" type="email" placeholder="Email">
<input class="input is-large" type="email" placeholder="Email" />
<span class="icon is-medium is-left">
<i class="fas fa-envelope"></i>
</span>
@@ -199,7 +202,9 @@ meta:
<div class="content">
<p>
The Bulma <code>input</code> CSS class is meant for <code>&lt;input&gt;</code> HTML elements. The following <a href="http://htmlreference.io/element/input/" target="_blank">type attributes</a> are supported:
The Bulma <code>input</code> CSS class is meant for <code>&lt;input&gt;</code> HTML elements. The following
<a href="http://htmlreference.io/element/input/" target="_blank">type attributes</a>
are supported:
</p>
<ul>
<li><code>type="text"</code></li>
@@ -207,97 +212,105 @@ meta:
<li><code>type="email"</code></li>
<li><code>type="tel"</code></li>
</ul>
<p>
Several <strong>modifiers</strong> are supported which affect:
</p>
<p>Several <strong>modifiers</strong> are supported which affect:</p>
<ul>
<li>the <strong><a href="#colors">color</a></strong></li>
<li>the <strong><a href="#sizes">size</a></strong></li>
<li>the <strong><a href="#states">state</a></strong></li>
<li>
the <strong><a href="#colors">color</a></strong>
</li>
<li>
the <strong><a href="#sizes">size</a></strong>
</li>
<li>
the <strong><a href="#states">state</a></strong>
</li>
</ul>
</div>
<div class="columns">
<div class="column is-half">
{{input_example}}
</div>
<div class="column is-half">{{ input_example }}</div>
<div class="column is-half bd-highlight-full">
{% highlight html %}{{input_example}}{% endhighlight %}
{% highlight html -%}
{{- input_example -}}
{%- endhighlight %}
</div>
</div>
{% include elements/anchor.html name="Colors" %}
{% include docs/elements/anchor.html name="Colors" %}
{% for color in site.data.colors.justColors %}
{% capture foobar %}
<input class="input is-{{ color }}" type="text" placeholder="{{ color | capitalize }} input">
{% capture foobar %}
<input
class="input is-{{ color }}"
type="text"
placeholder="{{ color | capitalize }} input"
/>
{% endcapture %}
{% include elements/snippet.html content=foobar %}
{% include docs/elements/snippet.html content=foobar %}
{% endfor %}
{% include elements/anchor.html name="Sizes" %}
{% include docs/elements/anchor.html name="Sizes" %}
{% for size in site.data.sizes %}
{% capture foobar %}
<input class="input is-{{ size }}" type="text" placeholder="{{ size | capitalize }} input">
{% capture foobar %}
<input
class="input is-{{ size }}"
type="text"
placeholder="{{ size | capitalize }} input"
/>
{% endcapture %}
{% include elements/snippet.html content=foobar %}
{% include docs/elements/snippet.html content=foobar %}
{% endfor %}
{% include elements/anchor.html name="Styles" %}
{% include docs/elements/anchor.html name="Styles" %}
<div class="columns">
<div class="column is-half">{{ rounded_example }}</div>
<div class="column is-half">
{{ rounded_example }}
</div>
<div class="column is-half">
{% highlight html %}{{ rounded_example }}{% endhighlight %}
{% highlight html -%}
{{- rounded_example -}}
{%- endhighlight %}
</div>
</div>
{% include elements/anchor.html name="States" %}
{% include docs/elements/anchor.html name="States" %}
<h4 class="title is-5">Normal</h4>
<div class="columns">
<div class="column is-half">{{ normal_example }}</div>
<div class="column is-half">
{{normal_example}}
</div>
<div class="column is-half">
{% highlight html %}{{normal_example}}{% endhighlight %}
{% highlight html -%}
{{- normal_example -}}
{%- endhighlight %}
</div>
</div>
<h4 class="title is-5">Hover</h4>
<div class="columns">
<div class="column is-half">{{ hover_example }}</div>
<div class="column is-half">
{{hover_example}}
</div>
<div class="column is-half">
{% highlight html %}{{hover_example}}{% endhighlight %}
{% highlight html -%}
{{- hover_example -}}
{%- endhighlight %}
</div>
</div>
<h4 class="title is-5">Focus</h4>
<div class="columns">
<div class="column is-half">{{ focus_example }}</div>
<div class="column is-half">
{{focus_example}}
</div>
<div class="column is-half">
{% highlight html %}{{focus_example}}{% endhighlight %}
{% highlight html -%}
{{- focus_example -}}
{%- endhighlight %}
</div>
</div>
<h4 class="title is-5">Loading</h4>
<div class="columns">
<div class="column is-half">{{ loading_example }}</div>
<div class="column is-half">
{{loading_example}}
</div>
<div class="column is-half">
{% highlight html %}{{loading_example}}{% endhighlight %}
{% highlight html -%}
{{- loading_example -}}
{%- endhighlight %}
</div>
</div>
@@ -305,58 +318,62 @@ meta:
<div class="column is-half">
<div class="content">
<p>
You can resize the loading spinner by appending <code>is-small</code>, <code>is-medium</code> or <code>is-large</code> to the <code>control</code> container.
You can resize the loading spinner by appending <code>is-small</code>, <code>is-medium</code> or
<code>is-large</code> to the <code>control</code> container.
</p>
</div>
{{loading_sizes_example}}
{{ loading_sizes_example }}
</div>
<div class="column is-half">
{% highlight html %}{{loading_sizes_example}}{% endhighlight %}
{% highlight html -%}
{{- loading_sizes_example -}}
{%- endhighlight %}
</div>
</div>
<h4 class="title is-5">Disabled</h4>
<div class="columns">
<div class="column is-half">{{ disabled_example }}</div>
<div class="column is-half">
{{disabled_example}}
</div>
<div class="column is-half">
{% highlight html %}{{disabled_example}}{% endhighlight %}
{% highlight html -%}
{{- disabled_example -}}
{%- endhighlight %}
</div>
</div>
<h4 class="title is-5">Readonly and static inputs</h4>
<div class="content">
<p>
If you use the <code>readonly</code> HTML attribute, the input will look similar to a normal one, but is not editable and has no shadow.
If you use the <code>readonly</code> HTML attribute, the input will look similar to a normal one, but is not
editable and has no shadow.
</p>
</div>
<div class="columns">
<div class="column is-half">{{ readonly_example }}</div>
<div class="column is-half">
{{ readonly_example }}
</div>
<div class="column is-half">
{% highlight html %}{{ readonly_example }}{% endhighlight %}
{% highlight html -%}
{{- readonly_example -}}
{%- endhighlight %}
</div>
</div>
<div class="content">
<p>
If you <em>also</em> append the <code>is-static</code> modifier, it removes the background, border, shadow, and horizontal padding, while maintaining the <strong>vertical spacing</strong> so you can easily align the input in any context, like a horizontal form.
If you <em>also</em> append the <code>is-static</code> modifier, it removes the background, border, shadow, and
horizontal padding, while maintaining the <strong>vertical spacing</strong> so you can easily align the input in any
context, like a horizontal form.
</p>
</div>
<div class="bd-example">
{{ static_example }}
</div>
{% highlight html %}{{ static_example }}{% endhighlight %}
<div class="bd-example">{{ static_example }}</div>
{% highlight html -%}
{{- static_example -}}
{%- endhighlight %}
<!-- Font Awesome Icons -->
{% include elements/anchor.html name="With Font Awesome icons" %}
{% include docs/elements/anchor.html name="With Font Awesome icons" %}
<div class="content">
<p>You can append one of 2 <strong>modifiers</strong> on a control:</p>
@@ -364,27 +381,21 @@ meta:
<li>
<code>has-icons-left</code>
</li>
<li>
and/or <code>has-icons-right</code>
</li>
<li>and/or <code>has-icons-right</code></li>
</ul>
<p>You also need to add a modifier on the <strong>icon</strong>:</p>
<ul>
<li>
<code>icon is-left</code> if <code>has-icons-left</code> is used
</li>
<li>
<code>icon is-right</code> if <code>has-icons-right</code> is used
</li>
<li><code>icon is-left</code> if <code>has-icons-left</code> is used</li>
<li><code>icon is-right</code> if <code>has-icons-right</code> is used</li>
</ul>
<p>The size of the <strong>input</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">
{{icons_example}}
</div>
<div class="column is-half">
{% highlight html %}{{icons_example}}{% endhighlight %}
{% highlight html -%}
{{- icons_example -}}
{%- endhighlight %}
</div>
</div>
@@ -392,45 +403,47 @@ meta:
<div class="column is-half">
<div class="content">
<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.
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>
</div>
{{has_icons_small_example}}
{{ has_icons_small_example }}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_small_example}}{% endhighlight %}
{% highlight html -%}
{{- has_icons_small_example -}}
{%- endhighlight %}
</div>
</div>
<div class="columns">
<div class="column is-half">{{ has_icons_normal_example }}</div>
<div class="column is-half">
{{has_icons_normal_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_normal_example}}{% endhighlight %}
{% highlight html -%}
{{- has_icons_normal_example -}}
{%- endhighlight %}
</div>
</div>
<div class="columns">
<div class="column is-half">{{ has_icons_medium_example }}</div>
<div class="column is-half">
{{has_icons_medium_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_medium_example}}{% endhighlight %}
{% highlight html -%}
{{- has_icons_medium_example -}}
{%- endhighlight %}
</div>
</div>
<div class="columns">
<div class="column is-half">{{ has_icons_large_example }}</div>
<div class="column is-half">
{{has_icons_large_example}}
</div>
<div class="column is-half">
{% highlight html %}{{has_icons_large_example}}{% endhighlight %}
{% highlight html -%}
{{- has_icons_large_example -}}
{%- endhighlight %}
</div>
</div>
{% include components/variables.html type='element'
variables_keys=page.variables_keys
folder='elements'
file='form'
{%
include docs/components/variables.html type='element'
variables_keys=page.variables_keys folder='elements' file='form'
%}