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
Events
Methods
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
falseExamples
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
falseExamples
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 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