PasswordTextBox — Smart UI JavaScript API

PasswordTextBox — Smart UI JavaScript API

On this page + Quick start

Quick start · JavaScript

Complete starter source per framework. Run the scaffold/install command first, then replace the listed files with the full code below.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>PasswordTextBox - JavaScript Quick Start</title>
  <link rel="stylesheet" href="./node_modules/smart-webcomponents/source/styles/smart.default.css" />
</head>
<body>
  <smart-password-text-box id="demo-passwordtextbox"></smart-password-text-box>

  <script type="module">
    import './node_modules/smart-webcomponents/source/modules/smart.passwordtextbox.js';

    const el = document.getElementById('demo-passwordtextbox');
    if (el) {

      el.placeholder = 'Your password';
      el.showPasswordIcon = true;
      el.value = 'P@ssw0rd!';

      el.addEventListener('change', (event) => console.log('change:', event.detail || event));
    }
  </script>
</body>
</html>
For AI tooling

Developer Quick Reference

Component: PasswordTextBox   Framework: JavaScript   Selector: smart-password-text-box

API counts: 28 properties, 2 methods, 2 events

Common properties: 0, 1, 2, 3, 4, 5

Common methods: focus(), reset()

Common events: change, changing

Module hint: smart-webcomponents/source/modules/smart.passwordtextbox.js

PasswordTextBox lets the user enter a password with the text hidden.

Class

PasswordTextBox

PasswordTextBox lets the user enter a password with the text hidden.

Selector

smart-password-text-box

Properties

AanimationSpecifies or retrieves the current animation mode. When set to 'none', all animations are disabled. If set to any other supported value, animations will be enabled according to the specified mode.
AautoFocusIndicates that the element will automatically receive keyboard focus as soon as the page is loaded, allowing users to interact with it immediately without clicking or tabbing to it. This is often used to improve accessibility and streamline user interaction with form fields or interactive elements.
DdisabledDetermines whether the element is interactive or inactive. When enabled, users can interact with the element; when disabled, the element becomes unresponsive to user actions such as clicks or input.
EenterKeyBehaviorDefines the action that occurs when the "Enter" key is pressed within the input field. By default, the mode is set to "submit", meaning pressing "Enter" will attempt to submit the associated form. You can customize this behavior by specifying alternative modes, such as preventing form submission or triggering a custom handler.
FformSpecifies the form element with which this element is associated (referred to as its "form owner"). The value of this attribute should be the id of a
element within the same HTML document. This allows the element to be associated with a form even if it is not nested inside the tags.
HhintDisplays supplemental helper text beneath the element, visible only while the element is focused. This text provides additional guidance or context to users during interaction.
LlabelDisplays a label positioned above the input element. This label remains persistently visible, providing a clear and accessible description of the input’s purpose at all times.
LlocaleSpecifies or retrieves the current language setting. This property determines which set of localized text strings from the messages property is used for display. When you set the language, the corresponding messages are shown to users in that language. When you get the language, it returns the currently active language code.
LlocalizeFormatFunctionCallback function that allows you to customize the formatting of messages returned by the Localization Module. This enables you to modify or enhance localized message strings—such as adding dynamic data, adjusting placeholders, or changing text structure—before they are displayed to users.
MmaxLengthSpecifies or retrieves the maximum number of characters allowed in the input field. If set, the user cannot enter more characters than this limit. This constraint helps enforce data validation and control the input length.
MmessagesDefines an object where each property corresponds to a specific password strength state, with associated string values that describe or label each state (e.g., "weak," "moderate," "strong"). This object is typically used to display feedback messages or labels reflecting the current strength of a user's password during input.
MminLengthSpecifies or retrieves the minimum number of characters required for user input. When set, the user must enter at least this many characters for the input to be considered valid.
NnameSets or retrieves the value of the element's name attribute. The name attribute is used to identify form fields when submitting HTML forms, allowing the data entered in the element to be included in the form's submission with the specified name as the key. This is essential for server-side processing of form data.
PpasswordStrengthWith this property, you can specify a custom callback function that evaluates the strength of a password. The function should accept the current password as input and return a string representing the assessed strength level. The returned string must be one of the following predefined values: 'short', 'weak', 'far', 'good', or 'strong'. This value will be used by the component to indicate how secure the entered password is according to your custom logic.
PplaceholderThis is the text that appears within the element when it is empty, serving as a prompt or hint to the user about the expected input. Once the user enters a value, this placeholder text disappears.
RrequiredEnhances the requirement that the user must provide a value for this element before the form can be submitted. If this field is left empty, the form submission will be blocked and the user will be prompted to enter a value. This ensures that the input is mandatory, helping maintain data completeness and integrity.
RrightToLeftSets or retrieves a value specifying whether the element’s alignment is adjusted to support right-to-left (RTL) languages, such as Arabic or Hebrew. When enabled, the element’s content and layout are adapted for proper display in locales that use right-to-left text direction.
SselectAllOnFocusDetermines if the entire content of the input field should be automatically highlighted (selected) when the input receives focus, making it easier for users to quickly replace or copy the content.
SshowPasswordIconSpecifies whether the password icon (such as an eye symbol to show or hide password text) is displayed in the input field.
SshowPasswordStrengthSpecifies whether a tooltip displaying the password strength indicator will be visible to the user during password entry. When enabled, this tooltip provides real-time feedback on the strength of the entered password.
TthemeSpecifies the visual theme to be applied. The theme controls the overall appearance and style—including colors, fonts, and backgrounds—of the element for a consistent look and feel.
TtooltipArrowSpecifies whether the Tooltip component should display an arrow pointing to the target element. Setting this option to true will show the arrow, while false will hide it.
TtooltipDelaySpecifies the amount of time, in milliseconds, to wait before displaying the tooltip after a user interaction (such as hovering or focusing on an element).
TtooltipPositionSpecifies the placement of the tooltip relative to the target element, such as "top", "bottom", "left", or "right". This controls where the tooltip will appear when it is displayed.
TtooltipTemplateSpecifies a custom template for rendering the tooltip’s content, allowing you to define the layout, formatting, and dynamic data within the tooltip. This enables greater control over the appearance and behavior of the tooltip beyond the default content.
UunfocusableIndicates whether the element should be excluded from keyboard navigation and cannot receive focus. If set to true, users will not be able to focus on the element using the keyboard or mouse interactions.
UunlockKeyGets or sets the unlockKey, a unique key required to activate and access the product. Use this property to retrieve the current unlock key or assign a new one to enable product unlocking functionality.
VvalueSets a new value for the element or retrieves its current value, depending on whether an argument is provided. Useful for updating or accessing the element’s data within a form or component.

Events

CchangeThis event is triggered whenever the value of the element is modified by the user or through programmatic changes. It occurs after the change has been committed, allowing you to respond to updates in the element’s value.
CchangingThis event is triggered whenever a key is released (key up) within the TextBox, but only if the TextBox's value has changed as a result of the key press. This ensures that the event fires solely when user input modifies the content, preventing unnecessary triggers when the value remains unchanged.

Methods

FfocusSets keyboard focus to the specified element, making it the active element on the page and enabling user input or interaction through the keyboard. This is commonly used to improve accessibility, guide user workflow, or trigger specific UI behaviors.
RresetThis method resets the input field to its initial value, discarding any changes made by the user and restoring the input's original state as specified when the component or element was first rendered.

Properties

animationSpecifies or retrieves the current animation mode. When set to 'none', all animations are disabled. If set to any other supported value, animations will be enabled according to the specified mode."none" | "simple" | "advanced"

Specifies or retrieves the current animation mode. When set to 'none', all animations are disabled. If set to any other supported value, animations will be enabled according to the specified mode.

Allowed Values

  • "none" - animation is disabled
  • "simple" - ripple animation is disabled
  • "advanced" - all animations are enabled

Default value

"advanced"

Examples

Markup and runtime examples for animation:

HTML:

<smart-password-text-box animation="none"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.animation = "simple";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const animation = el.animation;

autoFocusIndicates that the element will automatically receive keyboard focus as soon as the page is loaded, allowing users to interact with it immediately without clicking or tabbing to it. This is often used to improve accessibility and streamline user interaction with form fields or interactive elements.boolean

Indicates that the element will automatically receive keyboard focus as soon as the page is loaded, allowing users to interact with it immediately without clicking or tabbing to it. This is often used to improve accessibility and streamline user interaction with form fields or interactive elements.

Default value

false

Examples

Markup and runtime examples for autoFocus:

HTML attribute:

<smart-password-text-box auto-focus></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.autoFocus = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const autoFocus = el.autoFocus;

disabledDetermines whether the element is interactive or inactive. When enabled, users can interact with the element; when disabled, the element becomes unresponsive to user actions such as clicks or input.boolean

Determines whether the element is interactive or inactive. When enabled, users can interact with the element; when disabled, the element becomes unresponsive to user actions such as clicks or input.

Default value

false

Examples

Markup and runtime examples for disabled:

HTML attribute:

<smart-password-text-box disabled></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.disabled = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const disabled = el.disabled;

enterKeyBehaviorDefines the action that occurs when the "Enter" key is pressed within the input field. By default, the mode is set to "submit", meaning pressing "Enter" will attempt to submit the associated form. You can customize this behavior by specifying alternative modes, such as preventing form submission or triggering a custom handler."clearOnSubmit" | "submit"

Defines the action that occurs when the "Enter" key is pressed within the input field. By default, the mode is set to "submit", meaning pressing "Enter" will attempt to submit the associated form. You can customize this behavior by specifying alternative modes, such as preventing form submission or triggering a custom handler.

Allowed Values

  • "clearOnSubmit" - Clears the value of the input on Submit.
  • "submit" - Submits the value of the input but doesn't clear it.

Default value

"submit"

Examples

Markup and runtime examples for enterKeyBehavior:

HTML:

<smart-password-text-box enter-key-behavior="newLine"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.enterKeyBehavior = "submit";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const enterKeyBehavior = el.enterKeyBehavior;

formSpecifies the form element with which this element is associated (referred to as its "form owner"). The value of this attribute should be the id of a element within the same HTML document. This allows the element to be associated with a form even if it is not nested inside the tags.string

Specifies the form element with which this element is associated (referred to as its "form owner"). The value of this attribute should be the id of a element within the same HTML document. This allows the element to be associated with a form even if it is not nested inside the tags.

Default value

""

Examples

Markup and runtime examples for form:

HTML:

<smart-password-text-box form="form1"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.form = "form2";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const form = el.form;

hintDisplays supplemental helper text beneath the element, visible only while the element is focused. This text provides additional guidance or context to users during interaction.any

Displays supplemental helper text beneath the element, visible only while the element is focused. This text provides additional guidance or context to users during interaction.

Examples

Markup and runtime examples for hint:

HTML:

<smart-password-text-box hint="Helper text"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.hint = "Hint";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const hint = el.hint;

labelDisplays a label positioned above the input element. This label remains persistently visible, providing a clear and accessible description of the input’s purpose at all times.string

Displays a label positioned above the input element. This label remains persistently visible, providing a clear and accessible description of the input’s purpose at all times.

Default value

""

Examples

Markup and runtime examples for label:

HTML:

<smart-password-text-box label="Helper text"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.label = "Hint";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const label = el.label;

localeSpecifies or retrieves the current language setting. This property determines which set of localized text strings from the messages property is used for display. When you set the language, the corresponding messages are shown to users in that language. When you get the language, it returns the currently active language code.string

Specifies or retrieves the current language setting. This property determines which set of localized text strings from the messages property is used for display. When you set the language, the corresponding messages are shown to users in that language. When you get the language, it returns the currently active language code.

Default value

"en"

Examples

Markup and runtime examples for locale:

HTML:

<smart-password-text-box locale="de"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.locale = "fr";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const locale = el.locale;

localizeFormatFunctionCallback function that allows you to customize the formatting of messages returned by the Localization Module. This enables you to modify or enhance localized message strings—such as adding dynamic data, adjusting placeholders, or changing text structure—before they are displayed to users.function | null

Callback function that allows you to customize the formatting of messages returned by the Localization Module. This enables you to modify or enhance localized message strings—such as adding dynamic data, adjusting placeholders, or changing text structure—before they are displayed to users.

Examples

Markup and runtime examples for localizeFormatFunction:

HTML:

<smart-password-text-box localize-format-function="function(defaultMessage, message, messageArguments){return '...'}"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.localizeFormatFunction = "function(defaultMessage, message, messageArguments){return '...'}";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const localizeFormatFunction = el.localizeFormatFunction;

maxLengthSpecifies or retrieves the maximum number of characters allowed in the input field. If set, the user cannot enter more characters than this limit. This constraint helps enforce data validation and control the input length.number

Specifies or retrieves the maximum number of characters allowed in the input field. If set, the user cannot enter more characters than this limit. This constraint helps enforce data validation and control the input length.

Examples

Markup and runtime examples for maxLength:

HTML:

<smart-password-text-box max-length="120"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.maxLength = 150;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const maxLength = el.maxLength;

messagesDefines an object where each property corresponds to a specific password strength state, with associated string values that describe or label each state (e.g., "weak," "moderate," "strong"). This object is typically used to display feedback messages or labels reflecting the current strength of a user's password during input.object

Defines an object where each property corresponds to a specific password strength state, with associated string values that describe or label each state (e.g., "weak," "moderate," "strong"). This object is typically used to display feedback messages or labels reflecting the current strength of a user's password during input.

Default value




"en": {

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to {{files}}.",

"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.",

"invalidNode": "{{elementType}}: Invalid parameter '{{node}}' when calling {{method}}.",

"passwordStrength": "Password strength",

"short": "Short",

"weak": "Weak",

"far": "Far",

"good": "Good",

"strong": "Strong",

"showPassword": "Show password"

}

Examples

Markup and runtime examples for messages:

HTML:

<smart-password-text-box messages="{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss.","invalidNode":"{{elementType}}: Ungultiger Parameter '{{node}}' beim Aufruf von {{method}}.","passwordStrength":"Passwortstaerke","short":"kurz","weak":"schwach","far":"weit","good":"gut","strong":"stark","showPassword":"Passwort anzeigen"}}"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.","invalidNode":"{{elementType}}: Invalid parameter '{{node}}' when calling {{method}}.","passwordStrength":"Password strength","short":"Short","weak":"Weak","far":"Far","good":"Good","strong":"Strong","showPassword":"Show password"}};

Read the current value:

const el = document.querySelector('smart-password-text-box');
const messages = el.messages;

minLengthSpecifies or retrieves the minimum number of characters required for user input. When set, the user must enter at least this many characters for the input to be considered valid.number

Specifies or retrieves the minimum number of characters required for user input. When set, the user must enter at least this many characters for the input to be considered valid.

Default value

2

Examples

Markup and runtime examples for minLength:

HTML:

<smart-password-text-box min-length="20"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.minLength = 50;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const minLength = el.minLength;

nameSets or retrieves the value of the element's name attribute. The name attribute is used to identify form fields when submitting HTML forms, allowing the data entered in the element to be included in the form's submission with the specified name as the key. This is essential for server-side processing of form data.string

Sets or retrieves the value of the element's name attribute. The name attribute is used to identify form fields when submitting HTML forms, allowing the data entered in the element to be included in the form's submission with the specified name as the key. This is essential for server-side processing of form data.

Default value

""

Examples

Markup and runtime examples for name:

HTML:

<smart-password-text-box name="TextArea"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.name = "textarea";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const name = el.name;

passwordStrengthWith this property, you can specify a custom callback function that evaluates the strength of a password. The function should accept the current password as input and return a string representing the assessed strength level. The returned string must be one of the following predefined values: 'short', 'weak', 'far', 'good', or 'strong'. This value will be used by the component to indicate how secure the entered password is according to your custom logic.function | null

With this property, you can specify a custom callback function that evaluates the strength of a password. The function should accept the current password as input and return a string representing the assessed strength level. The returned string must be one of the following predefined values: 'short', 'weak', 'far', 'good', or 'strong'. This value will be used by the component to indicate how secure the entered password is according to your custom logic.

Examples

Markup and runtime examples for passwordStrength:

HTML:

<smart-password-text-box password-strength="function (password, allowedSymbols) { return 'weak'; }"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.passwordStrength = "function (password, allowedSymbols) { return 'strong'; }";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const passwordStrength = el.passwordStrength;

placeholderThis is the text that appears within the element when it is empty, serving as a prompt or hint to the user about the expected input. Once the user enters a value, this placeholder text disappears.string

This is the text that appears within the element when it is empty, serving as a prompt or hint to the user about the expected input. Once the user enters a value, this placeholder text disappears.

Default value

""

Examples

Markup and runtime examples for placeholder:

HTML:

<smart-password-text-box placeholder="Placeholder"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.placeholder = "PlaceHolder";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const placeholder = el.placeholder;

requiredEnhances the requirement that the user must provide a value for this element before the form can be submitted. If this field is left empty, the form submission will be blocked and the user will be prompted to enter a value. This ensures that the input is mandatory, helping maintain data completeness and integrity.boolean

Enhances the requirement that the user must provide a value for this element before the form can be submitted. If this field is left empty, the form submission will be blocked and the user will be prompted to enter a value. This ensures that the input is mandatory, helping maintain data completeness and integrity.

Default value

false

Examples

Markup and runtime examples for required:

HTML attribute:

<smart-password-text-box required></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.required = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const required = el.required;

rightToLeftSets or retrieves a value specifying whether the element’s alignment is adjusted to support right-to-left (RTL) languages, such as Arabic or Hebrew. When enabled, the element’s content and layout are adapted for proper display in locales that use right-to-left text direction.boolean

Sets or retrieves a value specifying whether the element’s alignment is adjusted to support right-to-left (RTL) languages, such as Arabic or Hebrew. When enabled, the element’s content and layout are adapted for proper display in locales that use right-to-left text direction.

Default value

false

Examples

Markup and runtime examples for rightToLeft:

HTML attribute:

<smart-password-text-box right-to-left></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.rightToLeft = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const rightToLeft = el.rightToLeft;

selectAllOnFocusDetermines if the entire content of the input field should be automatically highlighted (selected) when the input receives focus, making it easier for users to quickly replace or copy the content.boolean

Determines if the entire content of the input field should be automatically highlighted (selected) when the input receives focus, making it easier for users to quickly replace or copy the content.

Default value

false

Examples

Markup and runtime examples for selectAllOnFocus:

HTML attribute:

<smart-password-text-box select-all-on-focus></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.selectAllOnFocus = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const selectAllOnFocus = el.selectAllOnFocus;

showPasswordIconSpecifies whether the password icon (such as an eye symbol to show or hide password text) is displayed in the input field.boolean

Specifies whether the password icon (such as an eye symbol to show or hide password text) is displayed in the input field.

Default value

false

Examples

Markup and runtime examples for showPasswordIcon:

HTML attribute:

<smart-password-text-box show-password-icon></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.showPasswordIcon = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const showPasswordIcon = el.showPasswordIcon;

showPasswordStrengthSpecifies whether a tooltip displaying the password strength indicator will be visible to the user during password entry. When enabled, this tooltip provides real-time feedback on the strength of the entered password.boolean

Specifies whether a tooltip displaying the password strength indicator will be visible to the user during password entry. When enabled, this tooltip provides real-time feedback on the strength of the entered password.

Default value

false

Examples

Markup and runtime examples for showPasswordStrength:

HTML attribute:

<smart-password-text-box show-password-strength></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.showPasswordStrength = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const showPasswordStrength = el.showPasswordStrength;

themeSpecifies the visual theme to be applied. The theme controls the overall appearance and style—including colors, fonts, and backgrounds—of the element for a consistent look and feel.string

Specifies the visual theme to be applied. The theme controls the overall appearance and style—including colors, fonts, and backgrounds—of the element for a consistent look and feel.

Default value

""

Examples

Markup and runtime examples for theme:

HTML:

<smart-password-text-box theme="blue"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.theme = "red";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const theme = el.theme;

tooltipArrowSpecifies whether the Tooltip component should display an arrow pointing to the target element. Setting this option to true will show the arrow, while false will hide it.boolean

Specifies whether the Tooltip component should display an arrow pointing to the target element. Setting this option to true will show the arrow, while false will hide it.

Default value

false

Examples

Markup and runtime examples for tooltipArrow:

HTML attribute:

<smart-password-text-box tooltip-arrow></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.tooltipArrow = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const tooltipArrow = el.tooltipArrow;

tooltipDelaySpecifies the amount of time, in milliseconds, to wait before displaying the tooltip after a user interaction (such as hovering or focusing on an element).number

Specifies the amount of time, in milliseconds, to wait before displaying the tooltip after a user interaction (such as hovering or focusing on an element).

Default value

0

Examples

Markup and runtime examples for tooltipDelay:

HTML:

<smart-password-text-box tooltip-delay="200"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.tooltipDelay = 300;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const tooltipDelay = el.tooltipDelay;

tooltipPositionSpecifies the placement of the tooltip relative to the target element, such as "top", "bottom", "left", or "right". This controls where the tooltip will appear when it is displayed."absolute" | "bottom" | "top" | "left" | "right"

Specifies the placement of the tooltip relative to the target element, such as "top", "bottom", "left", or "right". This controls where the tooltip will appear when it is displayed.

Allowed Values

  • "absolute" - The tooltip is positioned absolutely by the user.
  • "bottom" - The tooltip is positioned below the input.
  • "top" - The tooltip is positioned above the input.
  • "left" - The tooltip is positioned to the left of the input.
  • "right" - The tooltip is positioned to the right the input.

Default value

"top"

Examples

Markup and runtime examples for tooltipPosition:

HTML:

<smart-password-text-box tooltip-position="left"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.tooltipPosition = "right";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const tooltipPosition = el.tooltipPosition;

tooltipTemplateSpecifies a custom template for rendering the tooltip’s content, allowing you to define the layout, formatting, and dynamic data within the tooltip. This enables greater control over the appearance and behavior of the tooltip beyond the default content.string

Specifies a custom template for rendering the tooltip’s content, allowing you to define the layout, formatting, and dynamic data within the tooltip. This enables greater control over the appearance and behavior of the tooltip beyond the default content.

Default value

"null"

Examples

Markup and runtime examples for tooltipTemplate:

HTML:

<smart-password-text-box tooltip-template="templateId1"></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.tooltipTemplate = "templateId2";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const tooltipTemplate = el.tooltipTemplate;

unfocusableIndicates whether the element should be excluded from keyboard navigation and cannot receive focus. If set to true, users will not be able to focus on the element using the keyboard or mouse interactions.boolean

Indicates whether the element should be excluded from keyboard navigation and cannot receive focus. If set to true, users will not be able to focus on the element using the keyboard or mouse interactions.

Default value

false

Examples

Markup and runtime examples for unfocusable:

HTML attribute:

<smart-password-text-box unfocusable></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.unfocusable = false;

Read the current value:

const el = document.querySelector('smart-password-text-box');
const unfocusable = el.unfocusable;

unlockKeyGets or sets the unlockKey, a unique key required to activate and access the product. Use this property to retrieve the current unlock key or assign a new one to enable product unlocking functionality.string

Gets or sets the unlockKey, a unique key required to activate and access the product. Use this property to retrieve the current unlock key or assign a new one to enable product unlocking functionality.

Default value

""

Examples

Markup and runtime examples for unlockKey:

HTML:

<smart-password-text-box unlock-key=""></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.unlockKey = "1111-2222-3333-4444-5555";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const unlockKey = el.unlockKey;

valueSets a new value for the element or retrieves its current value, depending on whether an argument is provided. Useful for updating or accessing the element’s data within a form or component.string

Sets a new value for the element or retrieves its current value, depending on whether an argument is provided. Useful for updating or accessing the element’s data within a form or component.

Default value

""

Examples

Markup and runtime examples for value:

HTML:

<smart-password-text-box value="Demo value."></smart-password-text-box>

Vanilla JS — prefer #id if multiple widgets exist on the page:

const el = document.querySelector('smart-password-text-box');
el.value = "New demo value.";

Read the current value:

const el = document.querySelector('smart-password-text-box');
const value = el.value;

Events

changeThis event is triggered whenever the value of the element is modified by the user or through programmatic changes. It occurs after the change has been committed, allowing you to respond to updates in the element’s value.CustomEvent

This event is triggered whenever the value of the element is modified by the user or through programmatic changes. It occurs after the change has been committed, allowing you to respond to updates in the element’s value.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onChange

Arguments

evCustomEvent
ev.detailObject
ev.detail.oldValue - The previous value of the element before it was changed.
ev.detail.value - The new value of the element.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Examples

Listen for change using the pattern that matches your stack.

DOM — listen on the custom element (use a specific selector if the page has more than one):

document.querySelector('smart-password-text-box')?.addEventListener('change', (event) => {
    const detail = event.detail,
        oldValue = detail.oldValue,
        value = detail.value;

	// event handling code goes here.
})

changingThis event is triggered whenever a key is released (key up) within the TextBox, but only if the TextBox's value has changed as a result of the key press. This ensures that the event fires solely when user input modifies the content, preventing unnecessary triggers when the value remains unchanged.CustomEvent

This event is triggered whenever a key is released (key up) within the TextBox, but only if the TextBox's value has changed as a result of the key press. This ensures that the event fires solely when user input modifies the content, preventing unnecessary triggers when the value remains unchanged.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onChanging

Arguments

evCustomEvent
ev.detailObject
ev.detail.oldValue - The previous value before it was changed.
ev.detail.value - The new value.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Examples

Listen for changing using the pattern that matches your stack.

DOM — listen on the custom element (use a specific selector if the page has more than one):

document.querySelector('smart-password-text-box')?.addEventListener('changing', (event) => {
    const detail = event.detail,
        oldValue = detail.oldValue,
        value = detail.value;

	// event handling code goes here.
})

Methods

focus(): voidSets keyboard focus to the specified element, making it the active element on the page and enabling user input or interaction through the keyboard. This is commonly used to improve accessibility, guide user workflow, or trigger specific UI behaviors.

Sets keyboard focus to the specified element, making it the active element on the page and enabling user input or interaction through the keyboard. This is commonly used to improve accessibility, guide user workflow, or trigger specific UI behaviors.

On the custom element in the DOM (narrow the selector, e.g. to #my-passwordtextbox, if you host multiple widgets):

document.querySelector('smart-password-text-box')?.focus();

reset(): voidThis method resets the input field to its initial value, discarding any changes made by the user and restoring the input's original state as specified when the component or element was first rendered.

This method resets the input field to its initial value, discarding any changes made by the user and restoring the input's original state as specified when the component or element was first rendered.

On the custom element in the DOM (narrow the selector, e.g. to #my-passwordtextbox, if you host multiple widgets):

document.querySelector('smart-password-text-box')?.reset();

CSS Variables

--smart-password-text-box-default-widthvar()

Default value

"var(--smart-editor-width)"

smartPasswordTextBox default width

--smart-password-text-box-default-heightvar()

Default value

"var(--smart-editor-height)"

smartPasswordTextBox default height