Vectored.Elements.Title (Vectored v0.4.0)

Copy Markdown View Source

The <title> element provides a short, human-readable name for an element.

Why use Title?

In SVG, <title> is primarily used for accessibility and tooltips.

  • Accessibility: Screen readers use the <title> to describe an element to users with visual impairments.
  • Tooltips: Most browsers will display the content of a <title> as a tooltip when the user hovers over the element.

Place the <title> as the first child of the element you want to describe. The with_title/2 function available on every element module (e.g. Vectored.Elements.Circle.with_title/2) is the recommended way to add a title to any shape.

Examples

Vectored.Elements.Circle.new(50)
|> Vectored.Elements.Circle.with_title("A descriptive tooltip")

Summary

Types

t()

@type t() :: %Vectored.Elements.Title{content: String.t() | nil}

Functions

new(content)

@spec new(String.t()) :: t()