Class Area


@Marshalled(typeName="area") public class Area extends HtmlElementVoid<Area>
DTO for an HTML <area> element.

The area element defines a clickable region within an image map. It is used in conjunction with the map element to create interactive images with multiple clickable areas, each linking to different destinations.

Examples:

// Rectangular clickable area Area area1 = area().shape("rect").coords("0,0,100,50").href("https://example.com/page1"); // Circular clickable area Area area2 = area().shape("circle").coords("150,75,50").href("https://example.com/page2"); // Area with alternative text and target Area area3 = area().shape("rect").coords("200,0,300,100").href("https://example.com/page3") .alt("Click here for more info") .target("_blank");

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

  • Method Details

    • alt

      public Area alt(String value)
      alt attribute.

      Specifies alternative text for the area. This text is displayed when the image map cannot be loaded and is used by screen readers for accessibility.

      The alt text should be descriptive and convey the same information as the clickable area.

      Parameters:
      value - Alternative text for the area. Can be null to unset the attribute.
      Returns:
      This object.
    • coords

      public Area coords(String value)
      coords attribute.

      Specifies the coordinates of the clickable area within the image map. The format depends on the shape:

      Coordinate formats:

      • "rect" - x1,y1,x2,y2 (top-left and bottom-right corners)
      • "circle" - x,y,radius (center point and radius)
      • "poly" - x1,y1,x2,y2,x3,y3,... (polygon vertices)
      • "default" - No coordinates needed
      Parameters:
      value - The coordinates defining the clickable area. Can be null to unset the attribute.
      Returns:
      This object.
    • download

      public Area download(Object value)
      download attribute.

      Whether to download the resource instead of navigating to it, and its file name if so.

      Parameters:
      value - The new value for this attribute. Typically a Boolean or String. Can be null to unset the attribute.
      Returns:
      This object.
    • href

      public Area href(Object value)
      href attribute.

      Address of the hyperlink.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      URIs defined by UriResolver can be used for values.

      Parameters:
      value - The new value for this attribute. Typically a URL or String. Can be null, in which case the attribute is stored with a null value (not removed).
      Returns:
      This object.
    • hreflang

      public Area hreflang(String value)
      hreflang attribute.

      Specifies the language of the linked resource. Used for SEO and accessibility purposes.

      Examples:

      • "en" - English
      • "es" - Spanish
      • "fr" - French
      • "de" - German
      • "zh" - Chinese
      • "ja" - Japanese
      Parameters:
      value - The language code of the linked resource. Can be null to unset the attribute.
      Returns:
      This object.
    • rel

      public Area rel(String value)
      rel attribute.

      Specifies the relationship between the current document and the linked resource.

      Common values:

      • "alternate" - Alternative version of the page
      • "author" - Link to the author of the page
      • "bookmark" - Permalink for bookmarking
      • "external" - External link
      • "help" - Link to help documentation
      • "license" - Link to license information
      • "next" - Next page in a sequence
      • "nofollow" - Don't follow this link for SEO
      • "noreferrer" - Don't send referrer information
      • "prev" - Previous page in a sequence
      • "search" - Link to search functionality
      • "tag" - Tag for the current page
      Parameters:
      value - The relationship between the document and linked resource. Can be null to unset the attribute.
      Returns:
      This object.
    • shape

      public Area shape(String value)
      shape attribute.

      Specifies the shape of the clickable area in an image map.

      Possible values:

      • "rect" - Rectangular area (default)
      • "circle" - Circular area
      • "poly" - Polygonal area
      • "default" - Entire image area
      Parameters:
      value - The shape of the clickable area. Can be null to unset the attribute.
      Returns:
      This object.
    • target

      public Area target(String value)
      target attribute.

      Specifies where to open the linked resource when the area is clicked.

      Common values:

      • "_blank" - Open in a new window/tab
      • "_self" - Open in the same frame (default)
      • "_parent" - Open in the parent frame
      • "_top" - Open in the full body of the window
      • "framename" - Open in a named frame
      Parameters:
      value - Where to open the linked resource. Can be null to unset the attribute.
      Returns:
      This object.
    • type

      public Area type(String value)
      type attribute.

      Specifies the MIME type of the linked resource. Helps browsers determine how to handle the resource.

      Common values:

      • "text/html" - HTML document
      • "text/css" - CSS stylesheet
      • "application/pdf" - PDF document
      • "image/png" - PNG image
      • "application/zip" - ZIP archive
      Parameters:
      value - The MIME type of the linked resource. Can be null to unset the attribute.
      Returns:
      This object.