View Source ScaledMetric

<ScaledMetric>

Tracks changed to the dynamic type size in the current context.

Overview

Use this element to scale a value with the accessibility dynamic type size.

<ScaledMetric phx-change="scaled-value-changed" value={100} relativeTo="largeTitle">
  <Image systemName="heart" class="resizable frame-attr" frame={@scaled_value}>
</ScaledMetric>
defmodule MyAppWeb.AccessibilityLive do
  def handle_event("scaled-value-changed", scaled_value, socket) do
    {:noreply, assign(socket, scaled_value: scaled_value)}
  end
end

The initial value of 100 will be used when dynamic type is disabled. If the dynamic type size is changed, the event referenced by phx-change will be updated with a scaled version of value. Optionally provide a Font.TextStyle to scale relative to with the relativeTo attribute.

Attributes

Bindings

  • scaledValue

SwiftUI Documentation

See SwiftUI.ScaledMetric for more details on this View.

References

The event to update with the scaled value.

The Font.TextStyle to scale with. Defaults to body.

The initial value to scale.