Class HeroModule

All Implemented Interfaces:
Component

public class HeroModule extends Module
Module for prominent hero/banner page sections with optional CTA links.

Mutability and thread-safety: mutable and not thread-safe. Hero content/button fields are mutable configuration state; mutate within a request-scoped flow. For reuse, stop mutating shared instances and render stable structures with per-request context data.

  • Constructor Details

    • HeroModule

      public HeroModule()
  • Method Details

    • create

      public static HeroModule create()
    • withTitle

      public HeroModule withTitle(String title)
      Description copied from class: Module
      Sets optional title consumed by Module.buildContent() implementations.
      Overrides:
      withTitle in class Module
    • withModuleId

      public HeroModule withModuleId(String moduleId)
      Description copied from class: Module
      Sets module id and synchronizes the underlying id attribute.
      Overrides:
      withModuleId in class Module
    • withSubtitle

      public HeroModule withSubtitle(String subtitle)
      Sets the subtitle text displayed below the title.
    • withDescription

      public HeroModule withDescription(String description)
      Sets the description text displayed below the subtitle.
    • withBackgroundImage

      public HeroModule withBackgroundImage(String imageUrl)
      Sets a background image using raw single-quoted CSS url() interpolation. Supply an application-controlled or separately CSS-context-validated value; there is no CSS escaping or Image validation. Image's scheme policy alone does not control CSS syntax.
      Parameters:
      imageUrl - URL or path to the background image
    • withBackgroundColor

      public HeroModule withBackgroundColor(String color)
      Sets raw CSS background color. Supply an application-controlled or separately CSS-context-validated value; attribute encoding is not declaration-breakout protection.
      Parameters:
      color - CSS color value
    • withPrimaryButton

      public HeroModule withPrimaryButton(String text, String url)
      Adds a primary CTA with an application-controlled or separately navigation-validated URL. The href is encoded without Link's scheme policy; null uses the existing fragment fallback.
      Parameters:
      text - button text
      url - button link URL
    • withSecondaryButton

      public HeroModule withSecondaryButton(String text, String url)
      Adds a secondary CTA with an application-controlled or separately navigation-validated URL. The href is encoded without Link's scheme policy; null uses the existing fragment fallback.
      Parameters:
      text - button text
      url - button link URL
    • centered

      public HeroModule centered()
      Centers all content in the hero section.
    • withCustomContent

      public HeroModule withCustomContent(Component content)
      Adds custom content to the hero section.
      Parameters:
      content - custom component to display
    • buildContent

      protected void buildContent()
      Description copied from class: Module
      Composes module structure.

      Called at most once by Module.build() unless Module.rebuildContent() is invoked. Do not rely on this method for per-request mutation.

      Specified by:
      buildContent in class Module