Text
A free-text card you push strings to from your sketch. Use it for status messages, last-seen timestamps, formatted readouts.
[image] Text widget on canvas, Body variant, no container, message « Connected to esp32-fan »
What it does
Text displays whatever string your sketch sends. The widget supports rich typography (variant, size, weight, decoration), four container styles (None / Filled / Outlined / Gradient), and an optional Highlighted color set you can switch to for emphasis.
When to use it
- Live status — Push a heartbeat message every second.
- Last sensor reading — Format the latest value as a string and push it (when a chart is overkill).
Properties
The Inspector opens as a bottom sheet with a Widget ID field at the top, then these sections in order.
Widget ID
| Property | Type | What it controls |
|---|---|---|
| Widget ID | text | Identifier used by your sketch (IText("…")). |
1. Essential
| Property | Type | Default | What it controls |
|---|---|---|---|
| Enabled | toggle | on | Whether the widget displays content. |
| Text | text | empty (placeholder Enter text…) | Initial string (your sketch updates it later). |
2. Header
| Property | Type | Default | What it controls |
|---|---|---|---|
| Show header | toggle | off | Display a header above the text. |
| Header text | text | empty (placeholder Label) | Header text. Only when Show header is on. |
| Alignment | Left / Center / Right | Center | Header text position. Only when Show header is on. |
3. Text style
| Property | Type | Default | What it controls |
|---|---|---|---|
| Size mode | Auto / Fixed | Auto | Whether text size auto-fits or stays fixed. |
| Variant | Display / Headline / Title / Subtitle / Body / Caption / Overline / Custom | Body | Typography variant. Only when Size mode is Fixed. |
| Custom size (sp) | 8–64 sp | 14 | Custom text size. Only when Variant is Custom. |
| Style | Normal / Bold / Italic / B+I / Light / Medium / Semi | Normal | Font weight and style. |
| Alignment | Start / Center / End / Justify | Start | Text alignment. |
| Decoration | None / Under / Strike | None | Text decoration. |
4. Container
| Property | Type | Default | What it controls |
|---|---|---|---|
| Style | None / Filled / Outlined / Gradient | None | Container appearance. |
| Corner radius | 0–32 | 8 | Container corner roundness. Only when Style is not None. |
| Padding | 0–24 | 12 | Inner spacing. Only when Style is not None. |
| Border width | 1–8 | 2 | Border stroke. Only when Style is Outlined. |
5. Effects
| Property | Type | Default | What it controls |
|---|---|---|---|
| Max lines | 1–10 | 3 | Wrap limit (∞ when set to max). |
| Fade-in animation | toggle | off | Fade in when the text changes. |
| Animation duration | 100–1000 ms | 300 ms | Fade duration. Only when Fade-in animation is on. |
6. Highlight
| Property | Type | Default | What it controls |
|---|---|---|---|
| Enable highlighted state | toggle | off | Adds an alternate color set you can switch to. |
7. Colors · Normal
| Property | Type | What it controls |
|---|---|---|
| Text | color | Text color. |
| Background | color | Container background. Only when Container style is not None. |
| Border | color | Container border. Only when Container style is Outlined. |
8. Colors · Highlighted
Only when Highlight is enabled.
| Property | Type | What it controls |
|---|---|---|
| Text | color | Text color (highlighted). |
| Background | color | Container background (highlighted). Only when Container style is not None. |
| Border | color | Container border (highlighted). Only when Container style is Outlined. |
States and behavior
[image] Four container styles side by side — None, Filled, Outlined, Gradient
[image] Same text in Normal vs Highlighted color sets
Two states: Normal and Highlighted. The state is set in the Inspector — your sketch only pushes the text, not the state.
In code
The widget mirrors what your sketch sends. To update its text:
instant.text("status_msg").setText("Connected to esp32-fan");
That single line is what shows up on the dashboard. Don’t put it directly in loop() — Arduino’s loop() runs thousands of times per second, which would flood the link. Use a timer to push at a sensible rate (200–1000 ms is plenty).
One method: .setText(const char* text) — max ~127 characters. See InstantIoT Library / Send Data to App.
Working Arduino code example
A complete sketch you can flash. The Widget ID status_msg matches the one you set on your Text widget in the app.
[gif] Text widget on the dashboard showing a live heartbeat updated every second by the ESP32
Direct Mode
Your phone connects directly to the ESP32’s SoftAP — no router, no server. Best for prototyping and standalone setups.
#include <InstantIoTWiFiAP.hpp>
#include <utils/InstantIoTTimer.hpp>
const char* AP_SSID = "InstantIoT-Greenhouse";
const char* AP_PASS = "12345678";
InstantIoTWiFiAP instant(AP_SSID, AP_PASS);
InstantTimer timers;
unsigned long eventCount = 0;
void pushStatus() {
if (!instant.connected()) return;
char buf[64];
snprintf(buf, sizeof(buf),
"Up %lus, %lu events",
millis() / 1000, eventCount);
instant.text("status_msg").setText(buf);
eventCount++;
}
void setup() {
instant.begin();
timers.every(1000, pushStatus);
}
void loop() {
instant.loop();
timers.run();
}
Server Mode
The ESP32 connects to your self-hosted InstantIoT Server over WiFi. Multiple devices, persistent state, history.
#include <InstantIoTWiFiServer.hpp>
#include <utils/InstantIoTTimer.hpp>
const char* WIFI_SSID = "YOUR_WIFI_SSID";
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
const char* SERVER_IP = "192.168.1.42";
const uint16_t SERVER_PORT = 9001;
const char* DEVICE_TOKEN = "YOUR_DEVICE_TOKEN";
InstantIoTWiFiServer instant(SERVER_IP, SERVER_PORT, DEVICE_TOKEN);
InstantTimer timers;
unsigned long eventCount = 0;
void pushStatus() {
if (!instant.connected()) return;
char buf[64];
snprintf(buf, sizeof(buf),
"Up %lus, %lu events",
millis() / 1000, eventCount);
instant.text("status_msg").setText(buf);
eventCount++;
}
void setup() {
instant.begin(WIFI_SSID, WIFI_PASS);
timers.every(1000, pushStatus);
}
void loop() {
instant.loop();
timers.run();
}
The widget code is identical — only the include and constructor change.
Notes
- This is a Display — no Target Devices dropdown.
- The 127-char cap is a hard limit driven by the on-wire frame size. Truncate or split your string if you need more.
Next
→ Metric — When the value is a number with a label and a unit.
→ LED — When the status is just on/off.
→ Advanced Chart — When you want history, not just the latest value.