HTML Block – HTML computed by an expression¶
The HTML block renders the HTML an expression produces. It is the last resort for content the other widgets cannot show – a small table, a formatted notice, an embedded progress bar.
This page is part of the widget reference.
1. At a glance¶
| Purpose | Shows HTML |
| Typical use | A formatted notice, a mini table from a web service answer, a progress bar |
| Related | Label for plain text, Embedded Page for a whole external page |
2. Settings¶
In addition, the widget has the settings every widget has.
| Setting | Meaning | Default |
|---|---|---|
| "Content" | An expression whose result is the HTML to render. HTML entities in the result are decoded before rendering. | none – required |
| "Isolate HTML" | Shows the HTML in a frame of its own instead of inserting it into the dashboard | off |
3. Behaviour¶
- The HTML is inserted into the dashboard as it is. nexxcite does not check or clean it.
- Styles inside the HTML apply to the whole page, not only to the widget. Give your own CSS classes a distinctive prefix, or put the CSS into the "Stylesheet" of the dashboard.
- Use the colour tokens in inline styles so that the HTML follows the theme, for example
style="color: rgb(var(--nx-danger))"(see Themes). - With "Auto Refresh" the expression is evaluated again at the interval.
Isolated HTML¶
With "Isolate HTML" switched on, the content is shown in a frame of its own:
- Styles inside the HTML only apply inside the frame and cannot change the rest of the dashboard.
- The standard styles of nexxcite are loaded into the frame, so its CSS classes and the colour tokens work there as well and follow the light or dark mode. The stylesheet of the dashboard, of the global settings and of roles does not reach the frame.
- The frame fills the widget and scrolls whatever does not fit. Give the widget a height with "Size".
- The frame is transparent: the background of the widget shows through, unless the HTML sets its own.
- Scripts and forms inside the HTML do not run. Links open in a new browser tab.
Never build the HTML from input users can type, such as a text field of a record, without escaping it. Otherwise one user can place HTML on the dashboard of other users.
4. Example¶
A notice with a link. "Content": a text expression returning
<div class="notice">Maintenance on Saturday from 8 am. <a href="/dashboards/…">Details</a></div>, with
the class notice defined in the stylesheet of the dashboard.
5. Limitations¶
- Scripts in the HTML are not a supported way to add behaviour. Use buttons with actions instead.
- The widget has no setting for scroll bars. Limit the height with "Size" and set
overflow: autoin "CSS Styles" if the content can grow. - With "Isolate HTML", colours defined in a theme do not reach the frame – it uses the built-in colours of the light or dark mode.