Draw a 2d line in the new UI

How would you go about drawing 2d lines in the new UI in Overlay mode?

I need a line between point A and B with thickness T. These values change runtime, so it has to be dynamic.

My first thought was to use line renderer but I can’t get it to work with the new UI.

I don’t think there’s a simple line drawing method for the UI.

As several people have mentioned in the comments, you can use an image.

Vector3 differenceVector = pointB - pointA;

imageRectTransform.sizeDelta = new Vector2( differenceVector.magnitude, lineWidth);
imageRectTransfom.pivot = new Vector2(0, 0.5f);
imageRectTransform.position = pointA;
float angle = Mathf.Atan2(differenceVector.y, differenceVector.x) * Mathf.Rad2Deg;
imageRectTransform.Rotation = Quaternion.Euler(0,0, angle);