Skip to content
On this page

Textarea

Basic textarea.

Usage

Import

ts
import { Atextarea } from "@agufaui/${framework name}";

Html

<atextarea /> or <Atextarea />

Configuration

Theme component name: atextarea

Showcase

Click to see code
vue
<atextarea
	:v="text"
	label="Comment"
	t="inlineblock"
	:rows="5"
	vc="dark:text-white"
	labelc="dark:(bg-#242424 text-white)"
	@update:v="notify($event)"
></atextarea>
<atextarea
	:v="text1"
	label="Comment"
	t="inlineblock"
	:rows="5"
	c="mt-3"
	vc="dark:text-white"
	disabled
	labelc="dark:(bg-#242424 text-white) !peer-focus-within:(-translate-y-100% ml-0 bg-transparent) !peer-not-placeholder-shown:(-translate-y-100% ml-0 bg-transparent)"
>
</atextarea>

AgufaUI provided Theme

CDefaultType is just string constant "default"

ts
import { CDefaultType, CUseType } from "@agufaui/config";
import type { IATextareaProps } from "../../types/basic/ATextarea";

export const CATextareaLabel = "text-4 bg-white text-gray-7 duration-300";
export const CATextareaLabelDisabled = "!peer-disabled:opacity-50";
export const CATextareaLabelError = "!peer-invalid:text-red-4";
export const CATextareaLabelFocus =
	"peer-focus-within:(scale-90 -translate-y-3 z-0 ml-3 px-1 py-0 text-indigo-4)";
export const CATextareaLabelPlaceholder =
	"peer-not-placeholder-shown:(scale-90 -translate-y-3 z-0 ml-3 px-1 py-0 text-indigo-4)";

export const DATextareaDefault = {
	vc: "block peer bg-transparent p-2 text-4 text-gray-7 outline outline-gray-3 rounded-md shadow-md disabled:(opacity-50 cursor-not-allowed) focus:(outline-none ring ring-indigo-2/50 shadow-indigo)",
	labelc: CATextareaLabel.concat(
		" ",
		CATextareaLabelFocus,
		" ",
		CATextareaLabelDisabled,
		" ",
		CATextareaLabelError,
		" ",
		CATextareaLabelPlaceholder
	),
};

export const DATextareaInlineBlock = {
	[CUseType]: CDefaultType,
	display: "inline-block",
};

export const DATextarea: Readonly<Record<string, Partial<IATextareaProps>>> = {
	[CDefaultType]: DATextareaDefault,
	inlineblock: DATextareaInlineBlock,
};

Attributes (Properties)

Default Values

vue
display: "block",

Unique

ts
export interface IATextareaProps extends IProps, IPropsForm {
	id?: string; // html element textarea 'id' and 'name' value, html element label 'for' value
	display?: string; // display class for root div html element
	v: string; // textarea text.  Not configurable
	vc?: string; // css classes for textarea html element
	maxlength?: number; // maxlength
	label?: string; // label text.  Not configurable
	labelc?: string; // css classes for label html element
}

Inherit from IProps

ts
export interface IProps {
	t?: string; // user defined or AgufaUI provided component type.  Not configurable
	c?: string; // css classes for component root html element
}

Inherit from IPropsForm

ts
export interface IPropsForm {
	disabled?: boolean; // disabled
}

Events

ts
export interface IATextareaEmits {
	(e: "update:v", modelValue: string): void; // textarea event
}

Released under the MIT License.