The Textarea
component allows users to input multi-line text. It’s ideal for longer text fields, such as descriptions, messages, or comments, and offers flexibility in terms of size using rows
and cols
props. Additionally, it provides the option to set a character limit using the maxChars
prop for better control over user input length.
<div class="gi-pt-2 gi-mb-4" > <label class="gi-text-md gi-mb-1 gi-block" for="textarea-id"> Textarea Label </label> <div class="gi-text-md gi-mb-2 gi-font-normal gi-text-gray-700"> Hint: This is a helpful hint. </div> <div class="gi-flex gi-items-center" data-module="gieds-textarea"> <textarea id="textarea-id" rows="4" cols="100" autocomplete="on" class="gi-textarea" maxlength="100" /> </div> </div>
{{ govieTextArea({ "id": "textarea-id" "label": { "content": "Textarea Label", "for": "textarea-id" }, "hint": { "content": "Hint text for textarea" }, "rows": 4, "cols": 100, }) }}
import { TextArea } from '@govie-ds/textarea'; <TextArea label={{ text: 'Comments' }} hint={{ text: 'Hint: This is a helpful hint' }} />
<div class="gi-pt-2 gi-mb-4" > <label class="gi-text-md gi-mb-1 gi-block" for="textarea-id"> Textarea Label </label> <div class="gi-text-md gi-mb-2 gi-font-normal gi-text-gray-700"> Hint: This is a helpful hint. </div> <div class="gi-flex gi-items-center" data-module="gieds-textarea"> <textarea id="textarea-id" rows="4" cols="100" autocomplete="on" class="gi-textarea" maxlength="100" /> </div> <div class="gi-textarea-remaining-chars"> <div class="gi-text-md gi-mb-2 gi-font-normal gi-text-gray-700 "> You have 100 characters remaining </div> </div> </div>
{{ govieTextArea({ "id": "textarea-id" "label": { "content": "Textarea Label", "for": "textarea-id" }, "hint": { "content": "Hint text for textarea" }, "maxChars": 30, "rows": 4, "cols": 100, }) }}
import { TextArea } from '@govie-ds/textarea'; <TextArea label={{ text: 'Comments' }} hint={{ text: 'Hint: This is a helpful hint' }} maxChars={100} />
Textarea
when the input requires multiple lines of text, such as:rows
and cols
to control the visible size of the text box, tailoring the component to your layout needs.maxChars
to limit the number of characters allowed.TextInput
component instead.DateInput
, NumberInput
, or Select
instead of Textarea
.Figma Library | Considering |
Local HTML | Stable |
Global HTML | Beta |
Global React | Beta |