plushie/widget/svg

SVG display widget builder.

Types

Option type for svg properties.

pub type Opt {
  Width(length.Length)
  Height(length.Length)
  ContentFit(content_fit.ContentFit)
  Rotation(Float)
  Opacity(Float)
  Color(color.Color)
  Alt(String)
  Description(String)
  Decorative(Bool)
  A11y(a11y.A11y)
}

Constructors

pub opaque type Svg

Values

pub fn a11y(s: Svg, a: a11y.A11y) -> Svg

Set accessibility properties for this widget.

pub fn alt(s: Svg, a: String) -> Svg

Set the alt text for accessibility.

pub fn build(s: Svg) -> node.Node

Build the svg into a renderable Node.

pub fn color(s: Svg, c: color.Color) -> Svg

Set the color.

pub fn content_fit(s: Svg, cf: content_fit.ContentFit) -> Svg

Set how content is fitted within the widget bounds.

pub fn decorative(s: Svg, d: Bool) -> Svg

Mark as decorative (ignored by screen readers).

pub fn description(s: Svg, d: String) -> Svg

Set the description text for accessibility.

pub fn height(s: Svg, h: length.Length) -> Svg

Set the height.

pub fn new(id: String, source: String) -> Svg

Create a new svg builder.

pub fn opacity(s: Svg, o: Float) -> Svg

Set the opacity (0.0 to 1.0).

pub fn opacity_animated(s: Svg, animation: node.PropValue) -> Svg

Set opacity to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn rotation(s: Svg, r: Float) -> Svg

Set the rotation angle in degrees.

pub fn rotation_animated(
  s: Svg,
  animation: node.PropValue,
) -> Svg

Set rotation to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn width(s: Svg, w: length.Length) -> Svg

Set the width.

pub fn with_opts(s: Svg, opts: List(Opt)) -> Svg

Apply a list of options to an svg builder.

Search Document