Reference
Unsafe
The one door for markup a page did not write. It has a single part, Unsafe.Html.
Unsafe
Before 5.0
No props to try.
From the CMS: read the guide.
Example
Unsafe.Html(sanitize("<p>From the <strong>CMS</strong>: <a href='/learn'>read the guide</a>.</p><script>alert(1)</script>"))
Markup from state, sanitised as it changes
state body = "<p>Draft <em>saved</em>.</p>"
Unsafe.Html(sanitize(body))
Props
This element takes no props of its own.
Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
No flags of its own.
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
It takes no slots.
Parts
The parts of Unsafe are written under its name, inside it. Each is described here, with what it takes.
Unsafe.Html
Markup, put in as markup. It is **not** sanitised — the name says so — and sanitize(…) is one call away for anything the project did not write itself.
Unsafe.Html(_ markup: String)
| Prop | Type | Unset | Meaning |
|---|---|---|---|
markup | String (positional) | none | The HTML to insert, as it is: not sanitised (wrap it in |
Codes this can raise
These controls list the props' cases; the example below shows them written.