Cards
You are reading the documentation for ESP-DASH v4.x.x, which is no longer the latest release. View the v5.x.x documentation.Text Input Card
Collect text input such as credentials or identifiers from the ESP-DASH Pro v4 dashboard with the text input card.
ESP-DASH Pro feature. This functionality is available only in the commercial edition of ESP-DASH.The text input card collects a string entered by the user on the dashboard. Use it for configurable values such as WiFi credentials, device names or user IDs.

Constructor
Card text(&dashboard, TEXT_INPUT_CARD, "User Email");Prop
Type
Callback
The callback fires when the user submits text on the dashboard. value is the submitted string.
Call update() with the received value and then dashboard.sendUpdates() inside the callback. Otherwise the dashboard does not register the input and the card remains in its waiting state.
text.attachCallback([&](const char* value) {
Serial.println("Text input: " + String(value));
text.update(value);
dashboard.sendUpdates();
});Methods
update()
Sets the text shown in the card. Call dashboard.sendUpdates() afterwards to push the change to connected clients.
text.update(const char* value);
text.update(const String &value);Example
#include <Arduino.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#elif defined(ESP32)
#include <WiFi.h>
#include <AsyncTCP.h>
#endif
#include <ESPAsyncWebServer.h>
#include <ESPDash.h>
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
AsyncWebServer server(80);
ESPDash dashboard(&server);
Card text(&dashboard, TEXT_INPUT_CARD, "User Email");
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi connection failed");
return;
}
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
text.attachCallback([&](const char* value) {
Serial.println("Text input: " + String(value));
text.update(value);
dashboard.sendUpdates();
});
server.begin();
}
void loop() {
// ...
}