Skip to main content

Textarea

scoped

Textarea extends the capabilities of the standard HTML textarea element. It adds styles to achieve a visually consistent user interface and offers features such as auto-height - adjusting the height of an element to the inserted text, or also a counter for inserted characters.

Basic usage

The preview shows the textarea in its default state without counter, auto-height or other adjustments.

Standard

Adding the standard attribute will display a textarea in the style of the standard HTML textarea element.

Counter

Adding the counter attribute will display a counter below the textarea showing the number of characters inserted and the maximum number of characters allowed. It is to be used in combination with the max-length property. Otherwise, the maximum number allowed will be set to 1000.

Resize (none)

The resize property specifies the behavior of element resizing. If set to none, the field size remains fixed.

Resize (auto)

If the resize property is set to auto, the size of the element is automatically adjusted to the inserted content.

Disabled

When the disabled attribute is inserted into the textarea element, it will not be possible to write.

When to use

Use wje-textarea when the user enters a value, selects options, or performs an action in a form.

When not to use

Don't just use it as a visual decorative element without interaction. In this case, give priority to the presentation components.

Accessibility

Always link the component to the description (label/aria-label), keep keyboard control, and display a clear message on validation errors.

  • Keep validation rules and error states consistent across the entire form.
  • For asynchronous operations, display the load status or disabled status.
  • For complex forms, prefer smaller sections and immediate feedback.

Attributes and properties

disabled

PopisVypína používateľskú interakciu s komponentom.
Atribútdisabled
Typboolean
Predvolené-

invalid

PopisRiadi validáciu alebo stavové hlášky pre voľbu invalid.
Atribútinvalid
Typboolean
Predvolenéfalse

label

PopisNastavuje zobrazený alebo prístupný textový štítok.
Atribútlabel
Typstring
Predvolenéfalse

name

PopisNastavuje názov poľa pri odoslaní formulára.
Atribútname
Typany
Predvolené-

placeholder

PopisNastavuje zástupný text pri prázdnej hodnote.
Atribútplaceholder
Typany
Predvolené-

readonly

PopisZabráni používateľovi upravovať hodnotu.
Atribútreadonly
Typboolean
Predvolené-

required

PopisOznačí komponent ako povinný pre validáciu formulára.
Atribútrequired
Typboolean
Predvolené-

rows

PopisNastavuje počet viditeľných riadkov textu.
Atribútrows
Typany
Predvolené-

validateOnChange

PopisUrčuje, či je voľba validate-on-change zapnutá a ovplyvňuje správanie komponentu.
Atribútvalidate-on-change
Typboolean
Predvolenéfalse

value

PopisNastavuje aktuálnu hodnotu komponentu.
Atribútvalue
Typstring
Predvolené-

Events

NázovPopis
wje-textarea:changeVyvolá sa pri zmene hodnoty komponentu.
wje-textarea:inputVyvolá sa pri zmene vstupnej hodnoty.

Methods

Pre tento komponent nie sú dostupné žiadne verejné metódy.

CSS shadow parts

NázovPopis
nativeŠtýluje koreňovú shadow časť komponentu.
inputŠtýluje shadow časť input.
wrapperŠtýluje obalovú shadow časť.

CSS custom variables

NázovPopis
--wje-textarea-font-familyVlastná CSS premenná, ktorá riadi typografiu.
--wje-textarea-background-colorVlastná CSS premenná, ktorá riadi background color.
--wje-textarea-colorVlastná CSS premenná, ktorá riadi color.
--wje-textarea-color-invalidVlastná CSS premenná, ktorá riadi color invalid.
--wje-textarea-error-background-colorVlastná CSS premenná, ktorá riadi error background color.
--wje-textarea-error-colorVlastná CSS premenná, ktorá riadi error color.
--wje-textarea-border-widthVlastná CSS premenná, ktorá riadi border width.
--wje-textarea-border-styleVlastná CSS premenná na štýlovanie komponentu (border style).
--wje-textarea-border-colorVlastná CSS premenná, ktorá riadi border color.
--wje-textarea-border-color-focusVlastná CSS premenná, ktorá riadi border color focus.
--wje-textarea-border-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.
--wje-textarea-margin-bottomVlastná CSS premenná, ktorá riadi margin bottom.
--wje-textarea-line-heightVlastná CSS premenná, ktorá riadi výšku riadku.
--wje-textarea-paddingVlastná CSS premenná, ktorá riadi padding.

Slots

Pre tento komponent nie sú dostupné žiadne sloty.