View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Toast
Toast notification from props, session flash or Turbo Streams into a Toaster
Toast message
This message fires a toast when the component connects.
<hw:toast type="success" position="top-end" message="Project saved" description="Your changes are now live." />
<p class="text-sm text-muted-foreground">This message fires a toast when the component connects.</p>
<div class="flex gap-5 my-8">
<hw:form action="{{ route('toast') }}" method="post">
<input type="hidden" name="type" value="success" />
<input type="hidden" name="message" value="Updated successfully." />
<hw:button variant="outline" type="submit">Success</hw:button>
</hw:form>
<hw:form action="{{ route('toast') }}" method="post">
<input type="hidden" name="type" value="error" />
<input type="hidden" name="message" value="The server restored the authoritative task state." />
<hw:button variant="outline" type="submit">Error</hw:button>
</hw:form>
<hw:form action="{{ route('toast') }}" method="post">
<input type="hidden" name="type" value="warning" />
<input type="hidden" name="message" value="Hey! Be Careful!" />
<hw:button variant="outline" type="submit">Warning</hw:button>
</hw:form>
<hw:form action="{{ route('toast') }}" method="post">
<input type="hidden" name="type" value="info" />
<input type="hidden" name="message" value="Drink water regularly." />
<hw:button variant="outline" type="submit">Info</hw:button>
</hw:form>
<hw:button id="optimistic-button" type="button" data-controller="optimistic--link">
Optimistic
<hw:optimistic target="optimistic-button" action="append">
<hw:toast type="success" position="top-center" message="Great!" description="Your changes are now live." />
</hw:optimistic>
</hw:button>
</div>