Class Header

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.components.Header
All Implemented Interfaces:
Component

public class Header extends HtmlTag
Heading component (H1-H6) with alignment and optional decorative bars.

Mutable and not thread-safe. Content and decoration state are composed on this instance. Mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.

  • Constructor Details

  • Method Details

    • H1

      public static Header H1(String text)
    • H2

      public static Header H2(String text)
    • H3

      public static Header H3(String text)
    • H4

      public static Header H4(String text)
    • H5

      public static Header H5(String text)
    • H6

      public static Header H6(String text)
    • withId

      public Header withId(String id)
      Sets the HTML id attribute for this header.

      When set, this id will be applied to the DOM element, allowing targeting via CSS selectors, JavaScript, or HTMX.

      Overrides:
      withId in class HtmlTag
      Parameters:
      id - the HTML id attribute value
      Returns:
      this Header for method chaining
    • getText

      public String getText()
    • getLevel

      public Header.HeaderLevel getLevel()
    • withClass

      public Header withClass(String className)
      Description copied from class: HtmlTag
      Overrides:
      withClass in class HtmlTag
    • left

      public Header left()
      Aligns header text to the left (default).
    • center

      public Header center()
      Aligns header text to the center.
    • right

      public Header right()
      Aligns header text to the right.
    • justify

      public Header justify()
      Justifies header text.
    • withTopBar

      public Header withTopBar()
      Adds a default horizontal divider above the header.
    • withTopBar

      public Header withTopBar(Component divider)
      Adds a custom divider above the header.
      Parameters:
      divider - the divider component to use
    • withBottomBar

      public Header withBottomBar()
      Adds a default horizontal divider below the header.
    • withBottomBar

      public Header withBottomBar(Component divider)
      Adds a custom divider below the header.
      Parameters:
      divider - the divider component to use
    • render

      public String render(RenderContext context)
      Description copied from class: HtmlTag
      Renders opening tag, text payload, child output, and closing tag.

      Security contract: slot and plain text are escaped; trusted HTML payload is emitted verbatim.

      Specified by:
      render in interface Component
      Overrides:
      render in class HtmlTag
      Parameters:
      context - context used for slot resolution and render policy
      Returns:
      rendered HTML for this component
    • render

      public String render()
      Description copied from interface: Component
      Renders this component with an empty context.
      Returns:
      rendered HTML for this component