Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

2.2 KB
Raw Blame
<main class="flex flex-col h-full w-full p-6" role="main" aria-label="Dropdown selection interface">
  <div class="max-w-md mx-auto w-full">
    <h1 class="text-xl font-semibold text-gray-900 mb-6">Select from dropdown</h1>

    <div class="flex flex-col gap-2">
      <label for="fruit-select" class="text-sm font-medium text-gray-700"> Choose a fruit: </label>
      <select
        id="fruit-select"
        class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white text-gray-900"
        aria-label="Fruit selection dropdown"
      >
        <option value="">-- Select a fruit --</option>
        <option value="apple">Apple</option>
        <option value="banana">Banana</option>
        <option value="orange">Orange</option>
        <option value="grape">Grape</option>
        <option value="mango">Mango</option>
        <option value="strawberry">Strawberry</option>
        <option value="watermelon">Watermelon</option>
      </select>
    </div>

    <!-- Selected Value Display -->
    <div class="mt-6 p-4 border border-gray-300 rounded-lg bg-gray-50">
      <p class="text-sm font-medium text-gray-700 mb-1">Selected:</p>
      <p id="selected-display" class="text-lg text-gray-900 font-semibold">None</p>
    </div>

    <div class="mt-4 p-3 bg-blue-50 border border-blue-200 rounded">
      <p class="text-sm text-blue-800">
        <iconify-icon icon="mdi:information" class="text-blue-600"></iconify-icon>
        Click the dropdown and select the specified fruit
      </p>
    </div>
  </div>

  <script>
    // Store selected value globally for evaluation
    window.__selectedValue = null;

    const dropdown = document.getElementById('fruit-select');
    const selectedDisplay = document.getElementById('selected-display');

    // Update the display and global value when selection changes
    dropdown.addEventListener('change', function () {
      const value = this.value;
      window.__selectedValue = value || null;

      // Update display
      const selectedOption = this.options[this.selectedIndex];
      selectedDisplay.textContent =
        selectedOption.text === '-- Select a fruit --' ? 'None' : selectedOption.text;
    });
  </script>
</main>