Link Card
This feature is only available in ESP-DASH Pro
The Link Card enables user redirection through clickable URL links on the dashboard.
Initializer
To create a link card in ESP-DASH v5, use the dash::LinkCard class.
dash::LinkCard link(dashboard, "Test Link");Methods
setValue(const char* url)
Set the URL to open when the card is clicked.
link.setValue("https://espdash.pro");- Signature:
void setValue(const char* url) - Parameters:
const char* url— The URL to open.
- Returns:
void
value()
Get the current URL value.
const char* url = link.value();- Signature:
const char* value() - Parameters: None
- Returns:
const char*— The current URL value.
setTarget(const char* target)
Set the target for the link. This can be _blank (default), _self, etc. _blank will open the link in a new tab and _self will open it in the same tab.
link.setTarget("_blank");- Signature:
void setTarget(const char* target) - Parameters:
const char* target— The target attribute for the link.
- Returns:
void
target()
Get the current target for the link.
const char* target = link.target();- Signature:
const char* target() - Parameters: None
- Returns:
const char*— The current target attribute.
Reference
A complete example showing how to use the Link Card in a real project. This demonstrates initialization, setting the URL, and updating it dynamically.
dash::LinkCard link(dashboard, "Test Link");
void setup() {
// ...
link.setValue("https://espdash.pro"); // Set URL for the link
link.setTarget("_blank"); // Open in new tab
}
void loop() {
// ...
}Last updated on