# `Plushie.Canvas.Line`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/canvas/line.ex#L1)

Canvas line element between two points with optional stroke and opacity.

# `option`

```elixir
@type option() ::
  (((({:x1, number()} | {:y1, number()}) | {:x2, number()}) | {:y2, number()})
   | {:stroke,
      %Plushie.Canvas.Stroke{
        cap: term(),
        color: term(),
        dash: term(),
        join: term(),
        width: term()
      }
      | keyword()
      | map()})
  | {:opacity, number()}
```

# `t`

```elixir
@type t() :: %Plushie.Canvas.Line{
  id: String.t() | nil,
  opacity:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  stroke:
    %Plushie.Canvas.Stroke{
      cap: term(),
      color: term(),
      dash: term(),
      join: term(),
      width: term()
    }
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  x1:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  x2:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  y1:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil,
  y2:
    number()
    | Plushie.Animation.Transition.t()
    | Plushie.Animation.Spring.t()
    | Plushie.Animation.Sequence.t()
    | nil
}
```

# `build`

```elixir
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
```

Converts this widget struct to a `ui_node()` map.

# `new`

# `new`

Creates a new element without an explicit ID (auto-assigned by parent container).

# `new`

Creates a new element with the given ID, positional args, and keyword options.

# `opacity`

```elixir
@spec opacity(widget :: t(), value :: number() | nil) :: t()
```

Opacity from 0.0 to 1.0.

Accepts `number()`.

# `stroke`

```elixir
@spec stroke(
  widget :: t(),
  value ::
    (%Plushie.Canvas.Stroke{
       cap: term(),
       color: term(),
       dash: term(),
       join: term(),
       width: term()
     }
     | keyword()
     | map())
    | nil
) :: t()
```

Stroke descriptor.

Accepts `%Plushie.Canvas.Stroke{}`.

# `type_name`

```elixir
@spec type_name() :: String.t()
```

Returns the element type string for the wire protocol.

# `with_options`

```elixir
@spec with_options(widget :: t(), opts :: [option()]) :: t()
```

Applies keyword options to an existing widget struct.

# `x1`

```elixir
@spec x1(widget :: t(), value :: number() | nil) :: t()
```

Start X in pixels.

Accepts `number()`.

# `x2`

```elixir
@spec x2(widget :: t(), value :: number() | nil) :: t()
```

End X in pixels.

Accepts `number()`.

# `y1`

```elixir
@spec y1(widget :: t(), value :: number() | nil) :: t()
```

Start Y in pixels.

Accepts `number()`.

# `y2`

```elixir
@spec y2(widget :: t(), value :: number() | nil) :: t()
```

End Y in pixels.

Accepts `number()`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
