# Aura Speed Test

A speed test card stack in frosted glass over a violet aura. A run counts the download figure up from zero while the dot spectrum fills from left to right, then measures ping and upload, lights the packet-loss grid packet by packet and sweeps the radar faster. When the run settles, the status chip shows the result. The first run starts when the card scrolls into view; click the chip (or focus it and press Enter) to run again.

<demo-aura-speed-test>



</demo-aura-speed-test>

## Installation

```bash
npx shadcn-vue@latest add "https://nxui.geoql.in/r/aura-speed-test.json"
```

## Usage

```vue
<script setup lang="ts">
  import { useTemplateRef } from 'vue';
  import AuraSpeedTest from '~/components/ui/aura-speed-test/AuraSpeedTest.vue';
  import type { AuraSpeedTestResult } from '~/components/ui/aura-speed-test/types';

  const meter = useTemplateRef<InstanceType<typeof AuraSpeedTest>>('meter');

  function onComplete(result: AuraSpeedTestResult): void {
    console.log(result.download, result.upload);
  }
</script>

<template>
  <AuraSpeedTest
    ref="meter"
    label="Home office / Wi-Fi 6"
    :download="912.3"
    :upload="204"
    :ping="9"
    :jitter="1.2"
    :packet-loss="2"
    server="PRG"
    distance="4 km"
    @complete="onComplete"
  />
  <button type="button" @click="meter?.run()">Test again</button>
</template>
```

The component animates toward the values you pass; it does not measure the network itself. Run your own test, then set the props and call `run()`.

## Props

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Home office / Wi-Fi 6'
      </code>
    </td>
    
    <td>
      Network name in the header.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        download
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        912.3
      </code>
    </td>
    
    <td>
      Final download speed in Mbps.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        upload
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        204
      </code>
    </td>
    
    <td>
      Final upload speed in Mbps.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ping
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        9
      </code>
    </td>
    
    <td>
      Final ping in ms.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        jitter
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        1.2
      </code>
    </td>
    
    <td>
      Jitter in ms, shown under the ping.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packet-loss
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        2
      </code>
    </td>
    
    <td>
      Packet loss in percent. Each lost percent is a gap.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        upload-note
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '+4% vs last week'
      </code>
    </td>
    
    <td>
      Note under the upload value.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        server
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'PRG'
      </code>
    </td>
    
    <td>
      Nearest server code.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        distance
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '4 km'
      </code>
    </td>
    
    <td>
      Distance to the server.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        duration
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        10000
      </code>
    </td>
    
    <td>
      Length of one run in ms. The spectrum axis follows it.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auto-run
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Starts a run the first time the card scrolls into view.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        testing-label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Testing…'
      </code>
    </td>
    
    <td>
      Chip text during a run.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        result-label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Excellent'
      </code>
    </td>
    
    <td>
      Chip text after a run.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        columns
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        38
      </code>
    </td>
    
    <td>
      Number of spectrum columns.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backdrop
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Paints the violet aura stage. Set <code>
        false
      </code>
      
       to use your own.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        class
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Extra classes for the root element.
    </td>
  </tr>
</tbody>
</table>

## Events and methods

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Payload
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        start
      </code>
      
       event
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Fires when a run starts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        complete
      </code>
      
       event
    </td>
    
    <td>
      <code>
        AuraSpeedTestResult
      </code>
    </td>
    
    <td>
      Fires when a run settles, with the final values.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        run()
      </code>
      
       method
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Starts a run from zero.
    </td>
  </tr>
</tbody>
</table>

## Accessibility

- The status chip is a button. It has a visible focus ring and is disabled during a run.
- The animated figures are hidden from screen readers. A polite live region reads the result once a run settles.
- The run pauses while the card is off screen.
- With reduced motion, a run jumps straight to the result and the radar stops sweeping.
