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 assistive text ​

You can use the assistive-text attribute to display a assistive text below the textarea.

This is an assistive text

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.

Minimum rows (compact / input-like) ​

Use the min-rows prop to control the initial (minimum) height of the textarea. It defaults to 3 lines. Set it to 1 to make the textarea start at the height of a regular input while keeping the autogrow behavior: it grows line by line as the user types.

Sizes ​

The size prop controls the padding (height) and text size of the textarea, mirroring the MazInput sizes (mini, xs, sm, md, lg, xl). Combined with :min-rows="1", a given size matches the height of a MazInput of the same size, while keeping the autogrow behavior.

Disabled ​

Props ​

NameDescriptionTypeRequiredDefaultPossible values
model-valuev-model The value of the textareaTNo--
idThe id of the textareastringNo--
nameThe name of the textareastringNo"MazTextarea"-
labelThe label of the textareastringNo--
placeholderThe placeholder of the textareastringNo--
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 textareastringNo--
colorThe color of the textarea"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"No"primary"'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'destructive' | 'contrast' | 'transparent'
rounded-sizeSize radius of the component's borderMazRoundedSizeNo'md'-
sizeControls the padding (height) and text size of the textarea, mirroring MazInput sizes. Combined with minRows, e.g. size="md" :min-rows="1" matches a regular input height."xs" | "sm" | "md" | "lg" | "xl" | "mini"No'md''xs' | 'sm' | 'md' | 'lg' | 'xl' | 'mini'
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-
min-rowsMinimum number of rows displayed by the textarea (initial/minimum height). With autogrow enabled, the textarea still grows beyond this with its content.numberNo3-
append-justifyThe alignment of the append slot"center" | "end" | "start" | "space-between" | "space-around" | "space-evenly"No"end"'center' | 'end' | 'start' | 'space-between' | 'space-around' | 'space-evenly'
top-labelStatic label displayed above the textarea. Unlike the floating label, this remains fixedstringNo--
assistive-textHelper text displayed below the input to provide additional context or validation feedbackstringNo--

Events ​

Event namePayloadDescription
update:model-valueT | undefinedEmitted when the value of the textarea change
inputT | undefinedEmitted when the value of the textarea change
focusFocusEventEmitted when the textarea is focused
blurFocusEventEmitted when the textarea is blurred
changeEventEmitted when the textarea value change

Slots ​

NameDescriptionBindings
label-
append-