This component combines both the input and textarea elements as options within a single component. Its default presentation includes a paired text label.
placeholder attribute) in place of an accessible label.We offer different sizes for instances in which the interface requires a smaller or larger input. In general, though, use the base 300 (medium) size input as much as possible, especially in forms.
<dt-input :size="100" type="text" label="Extra Small" placeholder="Placeholder" /> <dt-input :size="100" type="textarea" label="Extra Small" placeholder="Placeholder" /> <dt-input :size="200" type="text" label="Small" placeholder="Placeholder" /> <dt-input :size="200" type="textarea" label="Small" placeholder="Placeholder" /> <dt-input :size="300" type="text" label="Medium" placeholder="Placeholder" /> <dt-input :size="300" type="textarea" label="Medium" placeholder="Placeholder" /> <dt-input :size="400" type="text" label="Large" placeholder="Placeholder" /> <dt-input :size="400" type="textarea" label="Large" placeholder="Placeholder" /> <dt-input :size="500" type="text" label="Extra large" placeholder="Placeholder" /> <dt-input :size="500" type="textarea" label="Extra large" placeholder="Placeholder" />
An input is normally paired with a label, but there are times when it can be used without a label. Placeholder text should primarily be used as a content prompt and only provided when needed.
<dt-input label="Label" placeholder="Placeholder" /> <dt-input label="Label" model-value="Value" /> <dt-input label="Label" placeholder="Placeholder" disabled /> <dt-input label="Label" placeholder="Placeholder" type="textarea" /> <dt-input label="Label" type="textarea" model-value="Value" /> <dt-input label="Label" placeholder="Placeholder" type="textarea" disabled />
<dt-input label="Label" description="Helpful description text" placeholder="Placeholder"/> <dt-input label="Label" description="Helpful description text" type="textarea" placeholder="Placeholder"/>
Provides feedback to the user based on their interaction, or lack thereof, with an input. When a DtInput has an error message, it displays a red border to indicate the invalid state. The red border and error message appear when you pass a message with type: "error" to the messages prop. Success states show a green border, and warnings show a yellow border.
<dt-input label="Label" type="email" model-value="Value" :messages="[messages.critical]"/> <dt-input label="Label" type="email" model-value="Value" :messages="[messages.positive]"/> <dt-input label="Label" type="email" model-value="Value" :messages="[messages.warning]"/> <dt-input label="Label" type="textarea" model-value="Value" :messages="[messages.critical]"/> <dt-input label="Label" type="textarea" model-value="Value" :messages="[messages.positive]"/> <dt-input label="Label" type="textarea" model-value="Value" :messages="[messages.warning]"/>
<dt-input label="Label" type="email" model-value="Value" :messages="multipleMessages" />Adds validation for the input length. Make sure to provide the following props:
currentLength: the current character length that the user has entered into the input. This must be input manually as sometimes characters do not count as 1 character. For example an emoji could take up many characters in the input, but should only count as 1 character. If you don't pass currentLength, the component will use a built-in length calculation.validate: should be an object with the validation rules to apply to the input. Maximum length validation is supported with the following configuration:length: {
// describes the maximum length allowed and shown in the label
description: string, // Required
// maximum length allowed to enter
max: number, // Required
// message to show in the warning or error validation message
message: string, // Required
// length from which the validation message will be shown as a warning,
// when the maximum length is reached, the validation message will be shown as an error
warn: number, // Optional
// set maxlength attribute, defaults to false
limitMaxLength: boolean, // Optional
},
If the input is invalid due to the validation, the validation message will be shown even when the input lost focus, otherwise the validation message will be hidden when the user unfocuses the input.
<dt-input
model-value="Value"
label="Label"
placeholder="placeholder"
:validate="{
length: {
description: 'Max 25 characters.',
message: 'Max 25 characters allowed.',
max: 25,
warn: 15,
limitMaxLength: false,
}
}"
/><dt-input
model-value="Value"
label="Label"
placeholder="placeholder"
:validate="validate()"
/>const validateData = {
length: {
description: 'Max 25 characters.',
max: 25,
warn: 15,
limitMaxLength: false,
}
};
const validationMessage = () => {
const remainingCharacters = validateData.length.max - currentLength.value.length;
if (remainingCharacters < 0) {
return `${Math.abs(remainingCharacters)} characters over limit`;
} else {
return `${remainingCharacters} characters left`;
}
};
const validate = () => {
return {
length: {
...validateData.length,
message: validationMessage(),
}
};
};
Use type="search" with a clear button in the icon slot. When the input is not empty, the clear button will render and will clear the input field when triggered.
<dt-input aria-label="Search items" placeholder="Search Items" type="search" model-value="Search Value" > <template #startIcon="{ iconSize }"> <dt-icon name="search" :size="iconSize" /> </template> <template v-if="inputSearchValue.length !== 0" #endIcon="{ clear }"> <dt-stack class="d-pie-25"> <dt-button v-dt-tooltip="'Clear search'" kind="muted" importance="clear" :size="100" aria-label="Clear search" @click="clear" > <template #startIcon="{ iconSize }"> <dt-icon name="close" :size="iconSize" /> </template> </dt-button> </dt-stack> </template> </dt-input>
<dt-input label="Start icon" type="text" placeholder="Placeholder"> <template #startIcon="{ iconSize }"> <dt-icon name="send" :size="iconSize" /> </template> </dt-input> <dt-input label="End icon" type="text" placeholder="Placeholder"> <template #endIcon="{ iconSize }"> <dt-icon name="lock" :size="iconSize" /> </template> </dt-input> <dt-input label="Start and End icon" type="text" placeholder="Placeholder"> <template #startIcon="{ iconSize }"> <dt-icon name="send" :size="iconSize" /> </template> <template #endIcon="{ iconSize }"> <dt-icon name="lock" :size="iconSize" /> </template> </dt-input> <dt-input label="Start icon" type="textarea" placeholder="Placeholder"> <template #startIcon="{ iconSize }"> <dt-icon name="send" :size="iconSize" /> </template> </dt-input> <dt-input label="End icon" type="textarea" placeholder="Placeholder"> <template #endIcon="{ iconSize }"> <dt-icon name="lock" :size="iconSize" /> </template> </dt-input> <dt-input label="Start and End icon" type="textarea" placeholder="Placeholder"> <template #startIcon="{ iconSize }"> <dt-icon name="send" :size="iconSize" /> </template> <template #endIcon="{ iconSize }"> <dt-icon name="lock" :size="iconSize" /> </template> </dt-input>
Each Text Input size has a default icon size, keeping it proportional. While rare, customizing the icon size is possible.
<dt-input label="Medium input with smallest icon" type="text" placeholder="Placeholder" :size="300"> <template #startIcon> <dt-icon name="box-select" size="100" /> </template> <template #endIcon> <dt-icon name="box-select" size="100" /> </template> </dt-input> <dt-input label="Extra large input with medium icon" type="text" placeholder="Placeholder" :size="500"> <template #startIcon> <dt-icon name="box-select" size="200" /> </template> <template #endIcon> <dt-icon name="box-select" size="200" /> </template> </dt-input> <dt-input label="Medium textarea with large icon" type="textarea" placeholder="Placeholder" :icon-size="300" :size="400"> <template #startIcon> <dt-icon name="box-select" size="500" /> </template> </dt-input>
The label text size is automatically derived from the component's size prop. Use the label-size prop to override this when you need a different label size independent of the input size. For example, the default label size for a :size="300" input is 300, but you can override it from 100 to 400.
<dt-input label="Extra small label" placeholder="Placeholder" :label-size="100" />Override the label font weight independently of the label size. Valid values are bold, semibold, medium, and normal.
<dt-input label="Label" placeholder="Placeholder" label-strength="bold|semibold|medium|normal" />label for attribute match the input id.labels. Labelled inputs are user-friendly.label.aria-required property and use the validation message for input errors.aria-describedby with the id of the validation message.import { DtInput } from '@dialpad/dialtone-vue';
Name
|
Type
|
|---|---|
description | Slot for description, defaults to description prop |
endIcon | Slot for end icon |
label | Slot for label, defaults to label prop |
startIcon | Slot for start icon |
leftIcon Deprecated | Use startIcon |
rightIcon Deprecated | Use endIcon |
Name
|
Default
|
Type
|
|---|---|---|
currentLength | null | number The current character length that the user has entered into the input.
This will only need to be used if you are using |
description | '' | string Description for the input |
descriptionClass | '' | string|array|object Used to customize the description container |
disabled | false |
"true"
|
"false"
Disables the input |
endIconClass | '' | string|array|object Used to customize the end icon container |
hidden | false | boolean hidden allows to use input without the element visually present in DOM |
inputClass | '' | string|object|array Additional class name for the input element.
Can accept String, Object, and Array, i.e. has the
same API as Vue's built-in handling of the class attribute. |
inputWrapperClass | '' | string|object|array Additional class name for the input wrapper element.
Can accept all of: String, Object, and Array, i.e. has the
same api as Vue's built-in handling of the class attribute. |
label | '' | string Label for the input.
Can also be overridden with a slot of the same name. |
labelClass | '' | string|array|object Used to customize the label container |
labelSize | null |
"100"
|
"200"
|
"300"
|
"400"
Overrides the label text size. When not provided, the label size
is derived from the component size prop. |
labelStrength | null |
"bold"
|
"semibold"
|
"medium"
|
"normal"
Overrides the label font weight. |
messages | [] | array Validation messages |
messagesChildProps | {} | object A set of props that are passed into the validation messages component |
messagesClass | '' | string|array|object Used to customize the validation messages component |
modelValue | '' | string|number Value of the input |
name | '' | string Name property of the input element |
retainWarning | false | boolean Whether the input will continue to display a warning validation message even if the input has lost focus. |
showLabel | true |
"true"
|
"false"
Determines visibility of input label. |
showMessages | true |
"true"
|
"false"
Used to hide / show the validation messages |
size | 300 |
"100"
|
"200"
|
"300"
|
"400"
|
"500"
Size of the input. |
startIconClass | '' | string|array|object Used to customize the start icon container |
type | text |
"text"
|
"password"
|
"email"
|
"number"
|
"textarea"
|
"date"
|
"time"
|
"file"
|
"tel"
|
"search"
|
"color"
Type of the input.
When |
validate | null | object Validation for the input. Supports maximum length validation with the structure:
|
Name
|
Type
|
|---|---|
blur | FocusEvent Native input blur event |
clear | Input clear event |
focus | FocusEvent Native input focus event |
focusin | FocusEvent Native input focusin event |
focusout | FocusEvent Native input focusout event |
update:invalid | Boolean Result of the input validation |
update:length | Number Length of the input when currentLength prop is not passed |
update:modelValue | String | Number Event fired to sync the modelValue prop with the parent component |
Class
|
Applies to
|
Description
|
|---|
Input documentation last updated Friday, September 4, 2026
fix/popover-modal-zindex-scope