JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>App</title>
    <style>
      body {
        /* Prevent the user from selecting text in the example */
        user-select: none;
      }

      #container {
        width: 400px;
        height: 20px;
        background: blueviolet;
        padding: 10px;
      }
      
       #draggable {
        text-align: center;
        background: white;
      }

      .dragging {
        width: 422px;
        color: red;
        font-weight: 700;
      }
    </style>
  </head>
  <body>
    <div id="container">
      <div id="draggable" draggable="true">Drag me</div>
    </div>
    <div class="dropzone"></div>
  </body>
</html>

JavaScript

const source = document.getElementById("draggable");
source.addEventListener("dragstart", (event) => {
  event.target.classList.add("dragging");
});

source.addEventListener("dragend", (event) => {
  // reset the transparency
  event.target.classList.remove("dragging");
});