Content Block
<zn-content-block> | ContentBlock
Short summary of the component’s intended use.
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> <div slot="html">HTML <b>formatted</b> message <span style="color: cornflowerblue;">goes</span> here.</div> <div slot="footer" style="padding: 10px;"> <small> © 2025 Example Corp. All trademarks are property of their respective owners. </small> </div> </zn-content-block>
Examples
Basic Text
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> </zn-content-block>
Toggle Text & HTML
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> <div slot="html">HTML <b>formatted</b> message <span style="color: cornflowerblue;">goes</span> here.</div> </zn-content-block>
Editor Formatting
Text that holds escaped HTML, such as a note saved from zn-editor, is sanitized and rendered
with the editor’s formatting. Only the text and background colour survive from a
style attribute.
Bold
Italic
Underline
Strikethrough
Blockquote
Inline code
Code block
Coloured text
- Bullet
-
Bullet
- Nested bullet
-
Numbered
- Nested numbered
- Nested numbered
- Checked
- Unchecked
Divider above
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text"> <p><strong>Bold</strong></p> <p><em>Italic</em></p> <p><u>Underline</u></p> <p><s>Strikethrough</s></p> <blockquote>Blockquote</blockquote> <p><code>Inline code</code></p> <pre data-language=plain>Code block</pre> <p><span style=color:red>Coloured text</span></p> <ul><li>Bullet</li><li>Bullet<ul><li>Nested bullet</li></ul></li></ul> <ol><li>Numbered<ol><li>Nested numbered</li><li>Nested numbered</li></ol></li></ol> <ul><li data-list=checked>Checked</li><li data-list=unchecked>Unchecked</li></ul> <hr class=ql-hr> <p>Divider above</p> <p><a href=https://example.com>Link</a></p> </div> <div slot="html"> <p><strong>Bold</strong></p> <p><em>Italic</em></p> <p><u>Underline</u></p> <p><s>Strikethrough</s></p> <blockquote>Blockquote</blockquote> <p><code>Inline code</code></p> <pre data-language="plain">Code block</pre> <p><span style="color:red">Coloured text</span></p> <ul><li>Bullet</li><li>Bullet<ul><li>Nested bullet</li></ul></li></ul> <ol><li>Numbered<ol><li>Nested numbered</li><li>Nested numbered</li></ol></li></ol> <ul><li data-list="checked">Checked</li><li data-list="unchecked">Unchecked</li></ul> <hr class="ql-hr"> <p>Divider above</p> <p><a href="https://example.com">Link</a></p> </div> </zn-content-block>
Attachments
Attachments render in a row at the bottom of the content and are only visible while the block is expanded.
Use zn-chat-message-attachment, which assigns itself to the attachments slot. When
a block has attachments, a paperclip icon and count are shown in the header after the preview text.
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> <zn-chat-message-attachment href="/" name="filename1.txt" download></zn-chat-message-attachment> <zn-chat-message-attachment href="/" name="filename2.png" download></zn-chat-message-attachment> </zn-content-block>
Content Footer
Basic Footer
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> <div slot="footer" style="padding: 10px;"> <small> © 2025 Example Corp. All trademarks are property of their respective owners. </small> </div> </zn-content-block>
Footer with Attachments
<zn-content-block time="16 Jun 2025, 13:00" sender="John Smith" avatar="JS" > <div slot="text">Text formatted message goes here.</div> <div slot="footer"> <zn-collapsible caption="Attachments 2" flush> <zn-sp divide no-gap flush style="max-height: 241px; overflow-y: auto;"> <a href="/" target="_blank" download> <zn-tile caption="filename1.txt" description="10mb" inline> <zn-icon slot="image" src="attach_file" size="20"></zn-icon> </zn-tile> </a> <a href="/" target="_blank" download> <zn-tile caption="filename2.png" description="100kb" inline> <zn-icon slot="image" src="attach_file" size="20"></zn-icon> </zn-tile> </a> </zn-sp> </zn-collapsible> </div> </zn-content-block>
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.1.185/dist/components/content-block/content-block.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.1.185/dist/components/content-block/content-block.js';
To import this component using a bundler:
import '@kubex/zinc/dist/components/content-block/content-block.js';
Slots
| Name | Description |
|---|---|
attachments
|
Attachments displayed at the bottom of the content when the block is expanded. Use
zn-chat-message-attachment, which auto-assigns itself to this slot.
|
Learn more about using slots.
Parts
| Name | Description |
|---|---|
attachments |
The attachments row at the bottom of the content. |
header-attachments |
The attachment count indicator in the header. |
Learn more about customizing CSS parts.