# Aura Stability

A glass capsule that sums up how steady a connection was over a day. Each run is a vertical track from its smallest to its largest drift, drawn between dashed guide lines. Point at a track, or tab into the chart and use the arrow keys, to read that run's range above the chart. When the capsule first scrolls into view, a violet glow rises from its base and the stability score counts up.

<demo-aura-stability>



</demo-aura-stability>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import { ref } from 'vue';
  import AuraStability from '~/components/ui/aura-stability/AuraStability.vue';
  import type {
    AuraStabilityMarker,
    AuraStabilityRun,
  } from '~/components/ui/aura-stability/types';

  const runs: AuraStabilityRun[] = [
    { label: '06:00', min: 3.98, max: 9.14 },
    { label: '09:00', min: 2.65, max: 8.0 },
    { label: '12:00', min: 3.52, max: 9.21 },
    { label: '15:00', min: 5.57, max: 7.75 },
    { label: '18:00', min: 3.88, max: 9.13 },
    { label: '21:00', min: 4.89, max: 7.53 },
  ];
  const markers: AuraStabilityMarker[] = [
    { label: 'B', value: 9.21 },
    { label: 'A', value: 3.52 },
  ];
  const active = ref(-1);
</script>

<template>
  <AuraStability
    v-model:active="active"
    :runs="runs"
    :markers="markers"
    :stability="98.6"
  />
</template>
```

Leave `title` empty and the headline is built from the runs, for example “Six runs across the day. Speed never drifted more than 9.21%”.

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        runs
      </code>
    </td>
    
    <td>
      <code>
        AuraStabilityRun[]
      </code>
    </td>
    
    <td>
      six sample runs
    </td>
    
    <td>
      Runs to plot. Each has <code>
        label
      </code>
      
      , <code>
        min
      </code>
      
       and <code>
        max
      </code>
      
       drift in percent.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        stability
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        98.6
      </code>
    </td>
    
    <td>
      Score in percent. It also sets how high the glow rises.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        title
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Headline. Empty builds one from the runs.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        markers
      </code>
    </td>
    
    <td>
      <code>
        AuraStabilityMarker[]
      </code>
    </td>
    
    <td>
      B 9.21, A 3.52
    </td>
    
    <td>
      Dashed guide lines, each with a <code>
        label
      </code>
      
       and a <code>
        value
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Stability'
      </code>
    </td>
    
    <td>
      Word above the score.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        active
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        -1
      </code>
    </td>
    
    <td>
      <code>
        v-model:active
      </code>
      
      . Highlighted run; <code>
        -1
      </code>
      
       picks the largest drift.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backdrop
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Paints the night-sky 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

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

<tbody>
  <tr>
    <td>
      <code>
        update:active
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Fires when a run is hovered, focused or picked with the keyboard.
    </td>
  </tr>
</tbody>
</table>

## Accessibility

- Each run is a button labelled with its time and range. Only the highlighted run is in the tab order; the arrow keys, Home and End move between runs.
- The highlighted run sets `aria-current`, and its range is read through a polite live region.
- Every run button has a visible focus ring.
- With reduced motion, the glow and the score appear at once and the readout swaps without sliding.
