JSFiddle - React, Tailwind, and code Playground

HTML

<canvas width="500" height="500" id="canvas"></canvas>

JavaScript

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");

ctx.font = "15px Helvetica";
var text = 'hello test test';

function drawBubble(ctx, x, y, w, h, radius, text)
{
   var r = x + w;
   var b = y + h;

   ctx.beginPath();
   ctx.fillStyle = "red";
   ctx.fill();
   ctx.strokeStyle = "black";
   ctx.lineWidth = "2";
   ctx.moveTo(x + radius, y);

   ctx.lineTo(r - radius, y);
   ctx.quadraticCurveTo(r, y, r, y + radius);
   ctx.lineTo(r, y + h-radius);
   ctx.quadraticCurveTo(r, b, r - radius, b);
   ctx.lineTo(x + radius, b);
   ctx.quadraticCurveTo(x, b, x, b - radius);
   ctx.lineTo(x, y + radius);
   ctx.quadraticCurveTo(x, y, x + radius, y);
   ctx.stroke();
   ctx.fillText(text, x + 20, y + 30);
}

drawBubble(ctx, 10, 60, ctx.measureText(text).width + 40, 50, 20, text);