Skip to content

MazTextarea

MazTextarea is a standalone component that replaces the standard html textarea input with a beautiful design system. Many options like colors, disabled, error, warning, success and error messages are available.

Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started

INFO

This component uses the native CSS field-sizing: content property for autogrow — the textarea expands automatically as the user types, with zero JavaScript overhead.

Basic usage

With top-label

You can use the top-label attribute to display a top label above the textarea.

With label and append slots

You can use the label and append slots to customize the label and the append element.

With hint and state

You can use the hint attribute to display a hint message. This will replace the label.


Disable autogrow

By default, the textarea automatically expands as the user types. You can disable this behavior with the autogrow prop set to false — the textarea will then have a fixed height with a manual resize handle.

Disabled

Props

NameDescriptionTypeRequiredDefaultPossible values
styleStyle attribut of the component root elementNative typeNoundefined-
classClass attribut of the component root elementNative typeNoundefined-
model-valuev-model
TNoundefined-
idThe id of the textareastringNoundefined-
nameThe name of the textareastringNo'MazTextarea'-
labelThe label of the textareastringNoundefined-
placeholderThe placeholder of the textareastringNoundefined-
requiredIf the textarea is requiredbooleanNofalse-
disabledIf the textarea is disabledbooleanNofalse-
readonlyIf the textarea is readonlybooleanNofalse-
errorIf the textarea has an errorbooleanNofalse-
successIf the textarea has a successbooleanNofalse-
warningIf the textarea has a warningbooleanNofalse-
hintThe hint of the textareastringNoundefined-
colorThe color of the textareaMazColorNo'primary'-
rounded-sizeSize radius of the component's border"none" | "sm" | "md" | "lg" | "xl" | "full" | "base"Noundefined'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'base'
paddingIf the textarea has a paddingbooleanNotrue-
transparentIf the textarea has a transparent backgroundbooleanNofalse-
borderIf the textarea has no borderbooleanNotrue-
autogrowIf the textarea should autogrow based on its contentbooleanNotrue-
append-justifyThe alignment of the append slot"start" | "end" | "center" | "space-between" | "space-around" | "space-evenly"No'end''start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'
top-labelStatic label displayed above the textarea. Unlike the floating label, this remains fixedstringNoundefined-

Events

Event namePropertiesDescription
update:model-valuevalue string | undefined - The value of the textareaEmitted when the value of the textarea change
inputvalue string | undefined - The value of the textareaEmitted when the value of the textarea change
focusvalue Event - The eventEmitted when the textarea is focused
blurvalue Event - The eventEmitted when the textarea is blurred
changevalue Event - The eventEmitted when the textarea value change

Slots

NameDescriptionBindings
LabelReplace the label
AppendReplace the append