JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="myCanvas" width="50" height="300"></canvas>
JavaScript
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var height = canvas.height;
var space = 5;
var radius = 7;
var linelength = height / 2;
context.lineWidth = 4;
context.beginPath();
context.moveTo(20+radius, space);
context.arcTo(20, space, 20, space+radius, radius);
context.lineTo(20, linelength - radius);
context.arcTo(20, linelength, 20 - radius, linelength, radius);
context.arcTo(20, linelength, 20, linelength + radius, radius);
context.lineTo(20, height - space - radius);
context.arcTo(20, height - space, 20 + radius, height - space, radius);
context.stroke();