2017-07-17 15:02:18 +00:00
|
|
|
---
|
2017-07-29 12:02:00 +00:00
|
|
|
title: Textarea
|
2024-03-21 16:11:54 +00:00
|
|
|
layout: docs
|
|
|
|
theme: library
|
2017-07-17 15:02:18 +00:00
|
|
|
doc-tab: form
|
|
|
|
doc-subtab: textarea
|
2018-04-09 15:15:58 +00:00
|
|
|
breadcrumb:
|
2024-03-21 16:11:54 +00:00
|
|
|
- home
|
|
|
|
- documentation
|
|
|
|
- form
|
|
|
|
- form-textarea
|
2018-04-09 15:15:58 +00:00
|
|
|
meta:
|
|
|
|
colors: true
|
|
|
|
sizes: true
|
2024-09-18 13:46:10 +00:00
|
|
|
variables: true
|
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 %}
|
2024-03-21 16:11:54 +00:00
|
|
|
<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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +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>
|
2024-03-21 16:11:54 +00:00
|
|
|
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>:
|
2019-10-13 19:06:56 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=textarea_example %}
|
2018-10-05 13:07:17 +00:00
|
|
|
{% capture fixedsize_example %}
|
|
|
|
<div class="control">
|
2024-03-21 16:11:54 +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">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>You can set the height of the textarea using the <code>rows</code> HTML attribute.</p>
|
2018-04-09 15:15:58 +00:00
|
|
|
</div>
|
2017-07-21 07:46:03 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=textarea_rows_example %}
|
|
|
|
{% include docs/elements/anchor.html name="Colors" %}
|
2017-07-17 15:02:18 +00:00
|
|
|
|
2019-10-13 19:06:56 +00:00
|
|
|
<div class="content">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>The <code>textarea</code> element is available in several colors:</p>
|
2019-10-13 19:06:56 +00:00
|
|
|
</div>
|
|
|
|
|
2021-01-27 23:30:42 +00:00
|
|
|
{% for color in site.data.colors.justColors %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% capture foobar %}
|
|
|
|
<textarea
|
|
|
|
class="textarea is-{{ color }}"
|
|
|
|
placeholder="{{ color | capitalize }} textarea"
|
|
|
|
></textarea>
|
2021-01-27 23:30:42 +00:00
|
|
|
{% endcapture %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=foobar %}
|
2021-01-27 23:30:42 +00:00
|
|
|
{% endfor %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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>
|
2024-03-21 16:11:54 +00:00
|
|
|
The <code>textarea</code> element comes in
|
|
|
|
<strong>4 different sizes:</strong>
|
2019-10-13 19:06:56 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=sizes_example %}
|
|
|
|
{% include docs/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>
|
2024-03-21 16:11:54 +00:00
|
|
|
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>
|
2024-03-21 16:11:54 +00:00
|
|
|
<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>
|
2019-10-13 19:06:56 +00:00
|
|
|
</ul>
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>This allows you to obtain the style of a certain state without having to trigger it.</p>
|
2019-10-13 19:06:56 +00:00
|
|
|
</div>
|
|
|
|
|
2018-04-09 15:15:58 +00:00
|
|
|
<h4 class="subtitle">Normal</h4>
|
2017-08-30 21:33:52 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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>
|
2024-03-21 16:11:54 +00:00
|
|
|
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.
|
2018-04-09 15:15:58 +00:00
|
|
|
</p>
|
2017-11-06 13:44:58 +00:00
|
|
|
</div>
|
2024-03-21 16:11:54 +00:00
|
|
|
{{ loading_sizes_example }}
|
2018-04-09 15:15:58 +00:00
|
|
|
</div>
|
2021-01-27 23:30:42 +00:00
|
|
|
<div class="column is-half bd-highlight-full">
|
2024-03-21 16:11:54 +00:00
|
|
|
{% highlight html -%}
|
|
|
|
{{- loading_sizes_example -}}
|
|
|
|
{%- endhighlight %}
|
2018-04-09 15:15:58 +00:00
|
|
|
</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
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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>
|
2024-03-21 16:11:54 +00:00
|
|
|
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.
|
2018-04-09 15:15:58 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2017-09-18 22:33:19 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/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">
|
2024-03-21 16:11:54 +00:00
|
|
|
<p>You can disable a <code>textarea</code> resizing by appending the <code>has-fixed-size</code> modifier:</p>
|
2019-10-13 19:06:56 +00:00
|
|
|
</div>
|
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=fixedsize_example %}
|