Skip to content

Commit

Permalink
feat(toast): custom HTML allows templates
Browse files Browse the repository at this point in the history
  • Loading branch information
wuda-io authored and danice committed Feb 27, 2024
1 parent 471838c commit db76ce8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/materialize
Submodule materialize updated 1 files
+6 −2 src/toasts.ts
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions toasts.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h3 class="header">Options</h3>
<td>''</td>
<td>
<p>
Id of an HTML element that will be used as tootip content.
Id of an HTML Template element that will be used as tootip content.
</p>
</td>
</tr>
Expand Down Expand Up @@ -159,18 +159,20 @@ <h3 class="header">Properties</h3>
<h3 class="header">Custom HTML</h3>
<p>
You can pass in an toastId as the argument as well.
This toastId should refer to some element in the HTML that will be used as toast content.
This toastId should refer to some template in the HTML that will be used as toast content.
</p>
<button
type="button"
class="waves-effect waves-light btn"
onclick="M.toast({toastId: 'my-toast-1'})"
>Toast 1!
</button>
<div id="my-toast-1" style="display: none;">
<template id="my-toast-1">
<div>
This is toast nº1 with a
<a href="https://github.com/materializecss"> link </a>
</div>
</div>
</template>
<button
type="button"
class="waves-effect waves-light btn"
Expand All @@ -181,10 +183,12 @@ <h3 class="header">Custom HTML</h3>
This is toast nº2 with a <i class="material-icons icon-demo">insert_chart</i>
</div>
<pre><code class="language-markup">
<xmp><button type="button" class="btn" onclick="M.toast({toastId: 'my-toast-1'})">Toast 2!</button>
<div id="my-toast-1" style="display: none;">
This is toast nº1 with a <a href="https://github.com/materializecss">link</a>
</div></xmp></code></pre>
<xmp><button type="button" class="btn" onclick="M.toast({toastId: 'my-toast-1'})">Toast 1!</button>
<template id="my-toast-1">
<div>
This is toast nº1 with a <a href="https://github.com/materializecss"> link </a>
</div>
</template></xmp></code></pre>
</div>
<div id="callback" class="scrollspy section">
<h3 class="header">Callback</h3>
Expand Down

0 comments on commit db76ce8

Please sign in to comment.