Input <pm-input>
Single-line text field for text, email, numbers, passwords, search and more.
Sizes
Set with the size attribute; controls keep touch-sized targets on phones.
size="xs"size="sm"size="md"size="lg"size="xl"States
Each state is one attribute.
DisabledRead-onlyRequiredErrorAttributes
| Attribute | Type | Default | Description |
|---|---|---|---|
mask | string | — | Input mask: 9 a digit, a a letter, * either; other characters are typed for the user. E.g. mask="(999) 999-9999", mask="99/99", mask="aa-9999". |
strength | boolean | false | Show a strength bar under a password field (length and character variety; a guide, not a security check). |
icon-startprop: iconStart | string | — | Registered icon name shown before the content (see registerIcons); a start slot overrides it. |
icon-endprop: iconEnd | string | — | Registered icon name shown after the content (see registerIcons); an end slot overrides it. |
type | string | text | Native type of the underlying control. |
placeholder | string | — | Hint text shown while empty (not a replacement for label). |
autocomplete | string | — | Browser autofill hint (the HTML autocomplete token). |
inputmode | string | — | Virtual keyboard to show on touch devices (the HTML inputmode). |
pattern | string | — | Regular expression the value must match. |
minlength | number | — | Minimum number of characters. |
maxlength | number | — | Maximum number of characters. |
min | string | — | Lowest allowed value. |
max | string | — | Highest allowed value. |
step | string | — | Increment between allowed values. |
clearable | boolean | false | Shows a clear (✕) button when there is a value. |
password-toggleprop: passwordToggle | boolean | false | For type="password": a button to show/hide the password. |
show-countprop: showCount | boolean | false | Shows "n / maxlength" (or "n" without maxlength) under the input. |
name | string | — | Form field name: the value is submitted under it. |
value | string | — | Current value (submitted with the form). |
label | string | — | Visible label (required for accessibility; use hide-label to visually hide it). |
hint | string | — | Help text under the field, linked to it for screen readers. |
error | string | — | Custom error message. Setting it marks the control invalid. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | — | Control size. |
required | boolean | false | The form cannot be submitted until this has a value. |
disabled | boolean | false | Not interactive and not submitted. |
readonly | boolean | false | Focusable and submitted, but not editable. |
hide-labelprop: hideLabel | boolean | false | Hide the label visually; it stays the accessible name. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-clear | onPmClear | The clear button was pressed. |
pm-input | onPmInput | On every value change while editing. |
pm-change | onPmChange | When the value is committed. |
Slots
| Slot | Description |
|---|---|
end | Trailing adornment. |
start | Leading adornment (icon or text such as "https://"). |
CSS parts
| Part | Description |
|---|---|
::part(control) | The native input. |
::part(counter) | Character counter (with show-count). |
Methods
checkValidity(), reportValidity(), validate(), focus()
Used in templates
Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settingsSign inCreate accountForgot passwordChoose a new passwordProduct pageShopping cartCheckoutLanding pageArticleChangelogHelp centreContactComing soonNot found (404)Onboarding wizardAppointment bookingFeedback survey