Toddy.Iced.Widget.Tooltip (Toddy v0.3.0)

Copy Markdown View Source

Tooltip -- shows a popup tip over child content on hover.

The tip argument becomes the tip prop.

Props

  • tip (string) -- tooltip text (set automatically from the tip argument).
  • position (atom) -- tooltip position: :top (default), :bottom, :left, :right, :follow_cursor / :follow. See Toddy.Iced.Position.
  • gap (number) -- gap between tooltip and content in pixels.
  • padding (number) -- tooltip padding in pixels (uniform, not per-side).
  • snap_within_viewport (boolean) -- keep tooltip within viewport. Default: true.
  • delay (non_neg_integer) -- delay in milliseconds before showing the tooltip.
  • style (atom) -- named style (uses container styles). One of: :transparent, :rounded_box, :bordered_box, :dark, :primary, :secondary, :success, :danger, :warning.
  • a11y (map) -- accessibility overrides. See Toddy.Iced.A11y.

Summary

Functions

Sets accessibility annotations.

Converts this tooltip struct to a ui_node() map via the Toddy.Iced.Widget protocol.

Sets the tooltip delay in milliseconds before showing.

Appends multiple children to the tooltip.

Sets the gap between tooltip and content.

Creates a new tooltip struct with the given tip text and optional keyword opts.

Sets the tooltip padding.

Sets the tooltip position.

Appends a child to the tooltip.

Sets whether the tooltip snaps within the viewport.

Sets the tooltip style.

Applies keyword options to an existing tooltip struct.

Types

option()

@type option() ::
  {:position, Toddy.Iced.Position.t()}
  | {:gap, number()}
  | {:padding, number()}
  | {:snap_within_viewport, boolean()}
  | {:delay, non_neg_integer()}
  | {:style, style()}
  | {:a11y, Toddy.Iced.A11y.t()}

preset()

style()

@type style() :: preset() | Toddy.Iced.StyleMap.t()

t()

@type t() :: %Toddy.Iced.Widget.Tooltip{
  a11y: Toddy.Iced.A11y.t() | nil,
  children: [Toddy.Iced.ui_node() | struct()],
  delay: non_neg_integer() | nil,
  gap: number() | nil,
  id: String.t(),
  padding: number() | nil,
  position: Toddy.Iced.Position.t() | nil,
  snap_within_viewport: boolean() | nil,
  style: style() | nil,
  tip: String.t()
}

Functions

a11y(tt, a11y)

@spec a11y(tooltip :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()

Sets accessibility annotations.

build(tt)

@spec build(tooltip :: t()) :: Toddy.Iced.ui_node()

Converts this tooltip struct to a ui_node() map via the Toddy.Iced.Widget protocol.

delay(tt, delay)

@spec delay(tooltip :: t(), delay :: non_neg_integer()) :: t()

Sets the tooltip delay in milliseconds before showing.

extend(tt, children)

@spec extend(tooltip :: t(), children :: [Toddy.Iced.ui_node() | struct()]) :: t()

Appends multiple children to the tooltip.

gap(tt, gap)

@spec gap(tooltip :: t(), gap :: number()) :: t()

Sets the gap between tooltip and content.

new(id, tip, opts \\ [])

@spec new(id :: String.t(), tip :: String.t(), opts :: [option()]) :: t()

Creates a new tooltip struct with the given tip text and optional keyword opts.

padding(tt, padding)

@spec padding(tooltip :: t(), padding :: number()) :: t()

Sets the tooltip padding.

position(tt, position)

@spec position(tooltip :: t(), position :: Toddy.Iced.Position.t()) :: t()

Sets the tooltip position.

push(tt, child)

@spec push(tooltip :: t(), child :: Toddy.Iced.ui_node() | struct()) :: t()

Appends a child to the tooltip.

snap_within_viewport(tt, snap)

@spec snap_within_viewport(tooltip :: t(), snap :: boolean()) :: t()

Sets whether the tooltip snaps within the viewport.

style(tt, style)

@spec style(tooltip :: t(), style :: style()) :: t()

Sets the tooltip style.

with_options(tt, opts)

@spec with_options(tooltip :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing tooltip struct.