Skip to content
Stand with Ukraine flag

HTML Card

HTML Card widget

The HTML Card widget renders a static HTML block directly on a dashboard, with no datasource required. Use it for fixed-content panels that don’t depend on live data — instructions, legends, contact information, announcements, or decorative layout elements.

  • Render any HTML content on a dashboard card with no datasource or data subscription overhead.
  • Style with custom CSS scoped to the widget content — write it directly in the CSS field on the Appearance tab.
  • Attach ThingsBoard actions to specific HTML elements via On HTML element click — trigger navigation, state updates, or custom handlers from individual clickable zones within the card.
  • Works immediately with no configuration beyond the HTML itself.
  1. Open the dashboard in edit mode. Click Add widget in the top toolbar, or click the Add new widget icon in the center of an empty dashboard.
  2. In the widget bundle selection dialog, find and click Cards.
  3. Select the HTML Card widget.
  4. Enter the HTML content and click Add.

The widget is configured across four tabs: Appearance, Widget card, Actions, and Layout.

Write the card content in the HTML field. Any valid HTML is accepted — text, headings, tables, images, icons, or SVG. The field is required.

The default template places a centered label inside a flex container:

<div class='card'>HTML code here</div>

Write CSS in the CSS field to style the HTML content. Styles are scoped to the widget and do not affect other widgets on the dashboard. Class names defined in the HTML template are available here.

The default CSS centers and styles the .card element:

.card {
font-weight: bold;
font-size: 32px;
color: #999;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
SettingDescription
Display widget titleShow or hide the widget title bar. Disabled by default — the HTML fills the full card area.
TitleWidget title text shown in the header when the title bar is enabled. Default: HTML Card. Configure font and color.
Title tooltipOptional tooltip shown on title hover.
Display title iconShow an icon next to the title. Set icon type, size, and color.
Advanced title styleJSON object for custom title CSS (font size, weight, padding, etc.).
SettingDescription
Text colorDefault text color across the card.
Background colorCard background fill. Set to #FFFFFF00 (transparent) to let a CSS-defined background show through.
PaddingInner spacing between card edge and content. Default: 8px. Set to 0 when the HTML template manages its own padding.
MarginOuter spacing around the card.
Border radiusCorner rounding in pixels.
Drop shadowCard elevation shadow. Enabled by default.
Advanced widget styleJSON object for custom CSS applied to the widget container itself (outside the HTML content area).
Widget CSSAdditional CSS injected at the widget scope, separate from the content CSS on the Appearance tab.
SettingDescription
Enable fullscreenAdds a fullscreen toggle button to the widget header. Enabled by default.

The HTML Card supports two action sources:

SourceDescription
On HTML element clickTriggers a configured action when the user clicks a specific element inside the card HTML. Assign a CSS class to the target element in the HTML, then reference that class in the action configuration. This lets multiple elements in one card each trigger a different action.
Widget header buttonAdds a custom button to the widget header bar that triggers a configured action when clicked.
SettingDescription
ResizableAllow the widget to be resized on the dashboard grid. Enabled by default.
Preserve aspect ratioMaintain the width-to-height ratio when resizing.
SettingDescription
Hide widget in mobile modeHide the widget when the dashboard renders in mobile layout.
Hide widget in desktop modeHide the widget when the dashboard renders in desktop layout.
OrderPosition in the mobile layout stacking order.
HeightFixed height in rows for mobile layout.

Goal: Add a persistent reference panel to an operations dashboard showing shift contacts and a device-status color legend, so operators always have the information visible without switching tabs.

Step 1. Add the widget. Open your dashboard in edit mode, click Add widget, select Cards, then choose HTML Card.

Step 2. Enter the HTML. In the Appearance tab, replace the default content with:

<div class="ref-panel">
<section>
<h4>Shift contacts</h4>
<table>
<tr><td>Control room</td><td>ext. 101</td></tr>
<tr><td>Maintenance</td><td>ext. 204</td></tr>
<tr><td>Safety officer</td><td>ext. 312</td></tr>
</table>
</section>
<section>
<h4>Device status legend</h4>
<ul>
<li><span class="dot green"></span> Online &amp; reporting</li>
<li><span class="dot yellow"></span> Online, no data (last 15 min)</li>
<li><span class="dot red"></span> Offline</li>
</ul>
</section>
</div>

Step 3. Add CSS. In the CSS field, paste:

.ref-panel { padding: 16px; font-size: 13px; color: #333; }
.ref-panel section { margin-bottom: 16px; }
.ref-panel h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #666; }
.ref-panel table { width: 100%; border-collapse: collapse; }
.ref-panel td { padding: 4px 8px 4px 0; }
.ref-panel td:last-child { font-weight: 600; }
.ref-panel ul { list-style: none; padding: 0; margin: 0; }
.ref-panel li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.green { background: #4caf50; }
.yellow { background: #ffc107; }
.red { background: #f44336; }

Step 4. Configure the widget card. On the Widget card tab, set Background color to #FFFFFF00 and Padding to 0.

Step 5. Save. Click Add, resize and reposition as needed, then click Save on the dashboard toolbar.

Result: A compact reference panel sits alongside data widgets on the dashboard. The content is always visible with no data connection required.

HTML content is not displayed

CauseSolution
HTML field is emptyOpen widget configuration → Appearance and enter HTML in the HTML field.
Malformed HTMLValidate the HTML — missing closing tags or unclosed attributes can prevent rendering. Use the Tidy button in the editor to auto-format and catch obvious issues.

CSS styles are not applying

CauseSolution
Class name mismatchVerify the class names in the CSS exactly match those in the HTML template.
Styles overridden by widget defaultsUse more specific CSS selectors, or add !important as a last resort.
Wrong CSS fieldThe CSS field on the Appearance tab styles the HTML content. The Widget CSS field under Widget card → Advanced widget style applies to the widget container. Make sure you are editing the right one.

I need live data values in the card

CauseSolution
Wrong widget selectedThe HTML Card is for static content only. Use the HTML Value Card to insert ${key} placeholders, or the Markdown/HTML Card for Markdown and JavaScript-based dynamic content.

”On HTML element click” action is not triggering

CauseSolution
CSS class not assigned to the elementAdd the CSS class referenced in the action configuration to the target HTML element: <button class="my-action-btn">Click</button>.
Action not configuredOpen widget configuration → Actions and add an action with source On HTML element click, referencing the correct element class.