JSFiddle - React, Tailwind, and code Playground

by Fabio Dan

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Multi-Select Data Card Menu</title>
  <style>
    body {
      font-family: sans-serif;
      background: #f2f2f2;
      padding: 2rem;
    }

    .card {
      max-width: 400px;
      background: white;
      border-radius: 12px;
      box-shadow: 0 4px 10px rgba(0,0,0,0.08);
      padding: 1.5rem;
      margin: 0 auto;
    }

    .card h2 {
      margin-bottom: 0.75rem;
      font-size: 1.2rem;
    }

    .search {
      width: 100%;
      margin-bottom: 1rem;
    }

    .search input {
      width: 100%;
      padding: 0.5rem;
      border: 1px solid #ccc;
      border-radius: 6px;
    }

    .options {
      max-height: 180px;
      overflow-y: auto;
      margin-bottom: 1rem;
    }

    .option {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.5rem;
    }

    .actions {
      display: flex;
      justify-content: flex-end;
      gap: 0.5rem;
    }

    .button {
      padding: 6px 12px;
      font-size: 0.9rem;
      border-radius: 6px;
      cursor: pointer;
    }

    .button.cancel {
      border: 1px solid #ccc;
    }

    .button.apply {
      background: #0052cc;
      color: white;
      border: none;
    }

    .selected-output {
      font-size: 0.9rem;
      color: #444;
      margin-top: 1rem;
    }

    .selected-output span {
      font-weight: bold;
    }
  </style>
</head>
<body>

<div class="card">
  <h2>Select Reports</h2>

  <div class="search">
    <input type="text" placeholder="Search reports..." oninput="filterOptions(this.value)">
  </div>

  <div class="options" id="optionsList"></div>

  <div class="actions" id="actionBar">
    <button class="button cancel" onclick="cancelSelection()">Cancel</button>
    <button class="button apply" onclick="applySelection()">Apply</button>
  </div>

  <div class="selected-output" id="selectedOutput">Selected:...