Tobago Demo

Menu

Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta
Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta

Toast

Toasts represent a type of notification message, commonly associated with push notifications on mobile devices. The value attribute of the <tc:toasts/> tag contains a list of toasts objects, each representing a single toast. A toast object MUST implement the org.apache.myfaces.tobago.application.Toast interface. If a toast has been closed, the corresponding object is removed from the list. The content of the toasts is fully customizable.

Tag Library Documentation: <tc:toasts/>

ToastFacesMessage

FacesMessage but as a toast.

<tc:toasts id="toastFacesMessages" value="#{toastsController.toastFacesMessages}" var="toastFacesMessage" placement="bottomLeft"> <f:facet name="header"> <tc:panel> <tc:style customClass="rounded me-2 #{toastFacesMessage.severityColor}" width="1.25rem" height="1.25rem"/> </tc:panel> <strong> <tc:out value="#{toastFacesMessage.severityText}" plain="true"/> </strong> </f:facet> <tc:out value="#{toastFacesMessage.text}" plain="true"/> </tc:toasts>

Progress bar

Create a toast with a progress bar. Automatic dispose after a specific time is disabled ( disposeDelay="-1"). The close button is hidden ( markup="hideCloseButton"). The component is refreshed every 100ms. After the progress bar has reached 100%, the progress bar object is removed from the list ( value="#{toastsController.progressBars}". After the next refresh the related toast will also be removed from the page.

<tc:toasts id="progressBarToasts" value="#{toastsController.progressBars}" var="progress" disposeDelay="-1" markup="hideCloseButton"> <f:facet name="reload"> <tc:reload frequency="100"/> </f:facet> <f:facet name="header"> <tc:out value="Progress" plain="true"/> </f:facet> <tc:progress value="#{progress.value}" max="#{progress.max}"/> </tc:toasts>

Custom CSS class

To put a custom CSS class on a toast, use <tc:style customClass="..."/>.

<tc:toasts id="customToasts" value="#{toastsController.customCssToasts}" var="customToast"> <tc:style customClass="#{customToast.cssClass}"/> <f:facet name="header"> <tc:out value="Custom toast" plain="true"/> </f:facet> <tc:out value="The used CSS class is: #{customToast.cssClass}" plain="true"/> </tc:toasts>
© 2005-2025 Apache Software Foundation, Licensed under the Apache License, Version 2.0.