UNi Textarea Field
<uni-textarea-field /> is an encapsulated Web Component built upon the foundation of the uniopen design language.
Implementation is straightforward: simply slot a standard textarea element inside <uni-textarea-field />. The component instantly applies a user interface that aligns seamlessly with the uniopen design language guidelines. Furthermore, its visual styles can be dynamically adapted via native HTML attributes or JavaScript properties.
The component also exposes comprehensive character count and textarea length metadata, providing users with a clear and intuitive understanding of predefined character constraints.
Let's see what can <uni-textarea-field /> do ?
Basic Usage
<uni-textarea-field /> is a web component. All we need to do is put the required script into your HTML document. Then follow <uni-textarea-field />'s html structure and everything will be all set.
Required Script
Structure
Put <uni-textarea-field /> into HTML document. It will have different functions and looks with attribute mutation.
<uni-textarea-field /> dynamically adjusts its user interface and core functionality by strictly adhering to the attributes of the encapsulated textarea element. Developers can leverage these capabilities and observe the corresponding behavioral shifts by modifying standard attributes—such as readonly, disabled, required, and maxlength—directly on the textarea element.
JavaScript Instantiation
<uni-textarea-field /> could also use JavaScript to create DOM element. Here comes some examples.
Style Customization
Developers could apply styles to decorate <uni-textarea-field />'s looking.
<uni-textarea-field /> also leverages the CSS ::part() selector, enabling developers to directly customize and style the icon.
Alternatively, developers can utilize the data-hide-counter data attribute to suppress the character counter.
Attributes
<uni-textarea-field /> component exposes a curated set of attributes, enabling developers to dynamically adjust the user interface. This provides the flexibility to tailor the component’s appearance to seamlessly adapt to any given context.
size
The size attribute configures the overall dimensions of <uni-textarea-field />. The component currently supports three standard options: large, medium, and small, defaulting to medium.
subject
The subject attribute controls the dynamic rendering of the subject content on <uni-textarea-field />. By default, it is set to an empty string, meaning no content will be displayed.
message
The message attribute controls the dynamic rendering of the message content on <uni-textarea-field />. By default, it is set to an empty string, meaning no content will be displayed.
stat
Through variations in the stat attribute, <uni-textarea-field /> can dynamically transition between valid and invalid visual states, providing users with clear feedback on input correctness. By default, it is set to an empty string, which represents the standard, neutral state.
appearance
Currently, <uni-textarea-field /> supports two distinct visual variants: filled and outlined. Developers can utilize the appearance attribute to configure the desired layout, which defaults to filled.
Properties
| Property Name | Type | Description |
|---|---|---|
size
|
String | Getter / Setter size. size configures the overall dimensions of <uni-textarea-field />. The component currently supports three standard options: large, medium, and small, defaulting to medium. |
subject
|
String | Getter / Setter subject. subject controls the dynamic rendering of the subject content on <uni-textarea-field />. By default, it is set to an empty string, meaning no content will be displayed. |
message
|
String | Getter / Setter message. message controls the dynamic rendering of the message content on <uni-textarea-field />. By default, it is set to an empty string, meaning no content will be displayed. |
stat
|
String | Getter / Setter stat. stat can dynamically transition between valid and invalid visual states, providing users with clear feedback on input correctness. By default, it is set to an empty string, which represents the standard, neutral state. |
appearance
|
String | Getter / Setter appearance. appearance supports two distinct visual variants: filled and outlined. Developers can utilize the appearance attribute to configure the desired layout, which defaults to filled. |
Mathod
| Mathod Signature | Description |
|---|---|
refresh()
|
Force a UI refresh on <uni-textarea-field />. |