Textarea - Web Component
...
Browser support
Parameters
The Web component uses a <z-textarea>
tag.
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
config | string | The main parameter has two components following the pattern:
|
label | string | Label of the input |
readonly (optional) | boolean | Transforms the input into an output |
value (optional) | string | Value of the model |
disabled (optional) | boolean | Blocks the interaction with the input component. |
required (optional) | boolean | Marks the input component as required. |
name (optional) | string | Identification for the field inside the form |
invalid (optional) | boolean | The forced state for set the input as invalid |
help-text (optional) | string | The forced message to be shown under the input |
elastic (optional) | boolean | Makes the textarea auto-grow on typing |
The events emitted from the component are:
Name | Payload | Description |
---|---|---|
onchange | string | Returns the new value of the "value" attribute |
Playground
Customization
HTML Examples
Imports
html
<link rel="stylesheet" href="/0.3.7/@zurich/web-components/styles.css" />
<script type="module" src="/0.3.7/@zurich/web-components/textarea.js"></script>
Code
html
<!-- Default -->
<z-textarea label="Textarea"></z-textarea>
<z-textarea label="Textarea" config="shaped"></z-textarea>
<!-- With value -->
<z-textarea label="Textarea" value="Some text"></z-textarea>
<z-textarea label="Textarea" value="Some text" config="shaped"></z-textarea>
<!-- Disabled -->
<z-textarea label="Textarea" disabled></z-textarea>
<z-textarea label="Textarea" disabled config="shaped"></z-textarea>
<!-- Readonly -->
<z-textarea label="Textarea" readonly value="Some text"></z-textarea>
<z-textarea label="Textarea" readonly value="Some text" config="shaped"></z-textarea>
<!-- With help text -->
<z-textarea label="Textarea" help-text="Help text"></z-textarea>
<z-textarea label="Textarea" help-text="Help text" config="shaped"></z-textarea>
<!-- With maxlength -->
<z-textarea label="Textarea" max-length="20"></z-textarea>
<z-textarea label="Textarea" max-length="20" config="shaped"></z-textarea>
<!-- Invalid -->
<z-textarea label="Textarea" help-text="Invalid input" invalid></z-textarea>
<z-textarea label="Textarea" help-text="Invalid input" invalid config="shaped"></z-textarea>