bulma/docs/documentation/form/textarea.html

257 lines
6.6 KiB
HTML
Raw Normal View History

2017-07-17 15:02:18 +00:00
---
2017-07-29 12:02:00 +00:00
title: Textarea
2017-07-17 15:02:18 +00:00
layout: documentation
doc-tab: form
doc-subtab: textarea
2018-04-09 15:15:58 +00:00
breadcrumb:
- home
- documentation
- form
- form-textarea
meta:
colors: true
sizes: true
variables: false
2017-07-17 15:02:18 +00:00
---
{% capture textarea_example %}
2017-07-21 07:46:03 +00:00
<textarea class="textarea" placeholder="e.g. Hello world"></textarea>
{% endcapture %}
{% capture textarea_rows_example %}
<textarea class="textarea" placeholder="10 lines of textarea" rows="10"></textarea>
2017-07-17 15:02:18 +00:00
{% endcapture %}
{% capture colors_example %}
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-primary" placeholder="Primary textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-info" placeholder="Info textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-success" placeholder="Success textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-warning" placeholder="Warning textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-danger" placeholder="Danger textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
{% endcapture %}
{% capture sizes_example %}
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-small" placeholder="Small textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" placeholder="Normal textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-medium" placeholder="Medium textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-large" placeholder="Large textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
{% endcapture %}
{% capture normal_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" placeholder="Normal textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
{% endcapture %}
{% capture hover_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-hovered" placeholder="Hovered textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
{% endcapture %}
{% capture focus_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-focused" placeholder="Focused textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
{% endcapture %}
{% capture loading_example %}
<div class="control is-loading">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" placeholder="Loading textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
{% endcapture %}
{% capture loading_sizes_example %}
<div class="field">
<div class="control is-small is-loading">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-small" placeholder="Small loading textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control is-loading">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" placeholder="Normal loading textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control is-medium is-loading">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-medium" placeholder="Medium loading textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
<div class="field">
<div class="control is-large is-loading">
2018-10-25 17:10:26 +00:00
<textarea class="textarea is-large" placeholder="Large loading textarea"></textarea>
2017-07-17 15:02:18 +00:00
</div>
</div>
{% endcapture %}
{% capture disabled_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" placeholder="Disabled textarea" disabled></textarea>
2017-07-17 15:02:18 +00:00
</div>
{% endcapture %}
2017-09-18 22:33:19 +00:00
{% capture readonly_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea" readonly>This content is readonly</textarea>
2017-09-18 22:33:19 +00:00
</div>
{% endcapture %}
2019-10-13 19:06:56 +00:00
<div class="content">
<p>
The Bulma <code>textarea</code> CSS class is the multiline version of the <a href="{{ site.data.links.by_id.form-input.path }}"><code>input</code> element</a>:
</p>
</div>
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=textarea_example %}
2017-07-17 15:02:18 +00:00
2018-10-05 13:07:17 +00:00
{% capture fixedsize_example %}
<div class="control">
2018-10-25 17:10:26 +00:00
<textarea class="textarea has-fixed-size" placeholder="Fixed size textarea"></textarea>
2018-10-05 13:07:17 +00:00
</div>
{% endcapture %}
2018-04-09 15:15:58 +00:00
<div class="content">
<p>
2019-10-13 19:06:56 +00:00
You can set the height of the textarea using the <code>rows</code> HTML attribute.
2018-04-09 15:15:58 +00:00
</p>
</div>
2017-07-21 07:46:03 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=textarea_rows_example %}
2017-07-21 07:46:03 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Colors" %}
2017-07-17 15:02:18 +00:00
2019-10-13 19:06:56 +00:00
<div class="content">
<p>
The <code>textarea</code> element is available in several colors:
</p>
</div>
{% for color in site.data.colors.justColors %}
{% capture foobar %}
<textarea class="textarea is-{{ color }}" placeholder="{{ color | capitalize }} textarea"></textarea>
{% endcapture %}
{% include elements/snippet.html content=foobar %}
{% endfor %}
2017-07-17 15:02:18 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Sizes" %}
2017-07-29 14:54:51 +00:00
2019-10-13 19:06:56 +00:00
<div class="content">
<p>
The <code>textarea</code> element comes in <strong>4 different sizes:</strong>
</p>
</div>
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=sizes_example %}
2017-07-17 15:02:18 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="States" %}
2017-07-17 15:02:18 +00:00
2019-10-13 19:06:56 +00:00
<div class="content">
<p>
Bulma styles the different <strong>states</strong> of the <code>textarea</code> element. Each state is available as a pseudo-class and a CSS class:
2019-10-13 19:06:56 +00:00
</p>
<ul>
<li>
<code>:hover</code> and <code>is-hovered</code>
</li>
<li>
<code>:focus</code> and <code>is-focused</code>
</li>
<li>
<code>:active</code> and <code>is-active</code>
</li>
</ul>
<p>
This allows you to obtain the style of a certain state without having to trigger it.
</p>
</div>
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Normal</h4>
2017-08-30 21:33:52 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=normal_example %}
2017-07-17 15:02:18 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Hover</h4>
2017-08-30 21:33:52 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=hover_example %}
2017-07-17 15:02:18 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Focus</h4>
2017-08-30 21:33:52 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=focus_example %}
2017-07-17 15:02:18 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Loading</h4>
2017-08-30 21:33:52 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=loading_example %}
2017-07-17 15:02:18 +00:00
2018-04-09 15:15:58 +00:00
<div class="columns">
<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.
</p>
2017-11-06 13:44:58 +00:00
</div>
2018-04-09 15:15:58 +00:00
{{loading_sizes_example}}
</div>
<div class="column is-half bd-highlight-full">
2018-04-09 15:15:58 +00:00
{% highlight html %}{{loading_sizes_example}}{% endhighlight %}
</div>
</div>
2017-07-17 15:02:18 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Disabled</h4>
2017-07-17 15:02:18 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=disabled_example %}
2017-09-18 22:33:19 +00:00
2018-04-09 15:15:58 +00:00
<h4 class="subtitle">Readonly</h4>
2017-09-18 22:33:19 +00:00
2018-04-09 15:15:58 +00:00
<div class="content">
<p>
If you use the <code>readonly</code> HTML attribute, the textarea will look similar to a normal one, but is not editable and has no shadow.
</p>
</div>
2017-09-18 22:33:19 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/snippet.html content=readonly_example %}
2018-10-05 13:07:17 +00:00
<h4 class="subtitle">Fixed Size</h4>
2019-10-13 19:06:56 +00:00
<div class="content">
<p>
You can disable a <code>textarea</code> resizing by appending the <code>has-fixed-size</code> modifier:
</p>
</div>
2018-10-05 13:07:17 +00:00
{% include elements/snippet.html content=fixedsize_example %}