Interface HasViewHeaderTitle


public interface HasViewHeaderTitle
Implemented by views that want an auto-generated icon+title component in the adaptive view header slot. AppNavLayout checks for this interface on each navigation and places the result in the viewHeaderSlot (desktop only).

The default implementation calls getViewHeaderIcon() and reads PageTitle from the view class, then appends getViewHeaderSuffix() if non-null. Override getViewHeaderSuffix() to append a badge or other component after the title.

  • Method Summary

    Modifier and Type
    Method
    Description
    default com.vaadin.flow.component.icon.Icon
    Returns an icon for the view header, or null for no icon.
    default com.vaadin.flow.component.Component
    Returns a component to append after the title (e.g. a badge or status chip), or null to omit the suffix slot.
    default com.vaadin.flow.component.Component
    Returns the component to place in the view header title slot.
  • Method Details

    • getViewHeaderSuffix

      default com.vaadin.flow.component.Component getViewHeaderSuffix()
      Returns a component to append after the title (e.g. a badge or status chip), or null to omit the suffix slot.

      Called on every navigation event; return a new instance on each call.

    • getViewHeaderIcon

      default com.vaadin.flow.component.icon.Icon getViewHeaderIcon()
      Returns an icon for the view header, or null for no icon.

      Important: Icon is a live DOM component; each call to this method must return a new instance. Returning a cached Icon will cause it to be silently moved out of its current parent on each navigation event.

    • getViewHeaderTitle

      default com.vaadin.flow.component.Component getViewHeaderTitle()
      Returns the component to place in the view header title slot.

      Called on every navigation event. The default implementation composes an icon (from getViewHeaderIcon()), a heading (from PageTitle), and an optional suffix (from getViewHeaderSuffix()) into a horizontal layout. Override to replace the entire title component. Return null to suppress the slot.