Password Card

This feature is only available in ESP-DASH Pro

A secure input card for collecting and storing sensitive text data like passwords or secrets. Masks input values on the dashboard for enhanced privacy and security.
Initializer
To create a password card in ESP-DASH v5, use the dash::PasswordCard
class. The value type is always const char*
.
Example:
dash::PasswordCard password(dashboard, "Test Pass");
Callback
Register a callback function to be called when the password changes:
password.onChange([](const char* value) {
// Handle password input
Serial.printf("Password entered: %s\n", value);
});
Methods
setValue(const char* password)
Set the password value.
passwordCard.setValue("secret");
- Signature:
void setValue(const char* password)
- Parameters:
const char* password
— The password value to set.
- Returns:
void
value()
Get the current password value.
const char* pwd = passwordCard.value();
- Signature:
const char* value()
- Parameters: None
- Returns:
const char*
— The current password value.
Reference
Below is a reference code showing how to integrate this widget in a real project, including initialization and value updates usage.
// ...
// Create a password card
dash::PasswordCard passwordCard(dashboard, "Test Pass");
void setup() {
// ...
// Register callback for password input
password.onChange([](const char* value) {
Serial.printf("Password entered: %s\n", value);
// Use password securely
});
// Optionally set password value
password.setValue("secret");
}
void loop() {
// ...
}
Last updated on