# Equipment Panel

An overview of the devices behind a home battery system. Three LCD tiles show battery charge, inverter output and grid flow, each with a segmented bar. Below them, click a device row (or press Enter on it) to open it; a row with a chart shows a live line against its limit and an action button. The All / Alerts switch filters the table to the rows that need attention. With `live` on, the values drift a little every couple of seconds so the panel looks connected.

<demo-equipment-panel>



</demo-equipment-panel>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import { ref } from 'vue';
  import EquipmentPanel from '~/components/ui/equipment-panel/EquipmentPanel.vue';
  import type {
    EquipmentDevice,
    EquipmentTile,
  } from '~/components/ui/equipment-panel/types';

  const expanded = ref<string | null>('inverter');

  const tiles: EquipmentTile[] = [
    {
      key: 'battery',
      label: 'Battery',
      note: '17.3 kWh',
      value: 64,
      unit: '%',
      level: 0.64,
      color: '#4ade80',
    },
  ];

  const devices: EquipmentDevice[] = [
    {
      id: 'inverter',
      name: 'Inverter',
      detail: 'Hybrid · 7.6 kW',
      status: 'warn',
      level: 0.8,
      power: 4.82,
      temp: 41,
      action: 'Run check',
      chart: {
        label: 'Heatsink temp',
        points: [34, 36, 38, 39],
        limit: 45,
        limitLabel: 'Limit 45 °C',
        note: 'Fan 70 %',
      },
    },
  ];
</script>

<template>
  <EquipmentPanel
    v-model:expanded="expanded"
    :tiles="tiles"
    :devices="devices"
    @action="(d) => console.log(d.id)"
  />
</template>
```

Rows with `status: 'warn'` count as alerts. Rows without a `chart` open to a small level and power readout.

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        tiles
      </code>
    </td>
    
    <td>
      <code>
        EquipmentTile[]
      </code>
    </td>
    
    <td>
      Battery, Inverter, Grid
    </td>
    
    <td>
      LCD tiles: <code>
        key
      </code>
      
      , <code>
        label
      </code>
      
      , <code>
        note
      </code>
      
      , <code>
        value
      </code>
      
      , <code>
        decimals
      </code>
      
      , <code>
        unit
      </code>
      
      , <code>
        level
      </code>
      
      , <code>
        color
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        devices
      </code>
    </td>
    
    <td>
      <code>
        EquipmentDevice[]
      </code>
    </td>
    
    <td>
      Five devices
    </td>
    
    <td>
      Table rows. See the device options below.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        expanded
      </code>
    </td>
    
    <td>
      <code>
        string | null
      </code>
    </td>
    
    <td>
      <code>
        'inverter'
      </code>
    </td>
    
    <td>
      <code>
        v-model:expanded
      </code>
      
      . Id of the open row.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter
      </code>
    </td>
    
    <td>
      <code>
        'all' | 'alerts'
      </code>
    </td>
    
    <td>
      <code>
        'all'
      </code>
    </td>
    
    <td>
      <code>
        v-model:filter
      </code>
      
      . Which rows show.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        live
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Nudges values every 1.8 s while the card is on screen.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        title
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Equipment'
      </code>
    </td>
    
    <td>
      Header title.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        subtitle
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Device count
    </td>
    
    <td>
      Header subtitle.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        icon
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'lucide:text'
      </code>
    </td>
    
    <td>
      Icon in the header chip.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        firmware
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Firmware 26.4.1 · up to date'
      </code>
    </td>
    
    <td>
      Footer status text.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        add-label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'Add device'
      </code>
    </td>
    
    <td>
      Text of the add button.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        accent
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '#ff9a2e'
      </code>
    </td>
    
    <td>
      Warnings, LCD labels, the open row border and charts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ok-color
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '#4ade80'
      </code>
    </td>
    
    <td>
      Healthy status dots.
    </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>

## Device options

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Unique id.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      First line.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        detail
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Second line.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        'ok' | 'warn' | 'idle'
      </code>
    </td>
    
    <td>
      Dot colour. <code>
        warn
      </code>
      
       rows are alerts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        level
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Level bar fill, 0 to 1.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        levelColor
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Level bar colour.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        power
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Power in kW.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        signed
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Adds <code>
        +
      </code>
      
       to positive power.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        temp
      </code>
    </td>
    
    <td>
      <code>
        number | null
      </code>
    </td>
    
    <td>
      Temperature in °C. <code>
        null
      </code>
      
       shows a dash.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        chart
      </code>
    </td>
    
    <td>
      <code>
        EquipmentChart
      </code>
    </td>
    
    <td>
      <code>
        label
      </code>
      
      , <code>
        points
      </code>
      
      , <code>
        limit
      </code>
      
      , <code>
        limitLabel
      </code>
      
      , <code>
        note
      </code>
      
      , <code>
        min
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        action
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Label of the button in the open row.
    </td>
  </tr>
</tbody>
</table>

## Events

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

<tbody>
  <tr>
    <td>
      <code>
        update:expanded
      </code>
    </td>
    
    <td>
      <code>
        string | null
      </code>
    </td>
    
    <td>
      A row opened or closed.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        update:filter
      </code>
    </td>
    
    <td>
      <code>
        'all' | 'alerts'
      </code>
    </td>
    
    <td>
      The filter changed.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        action
      </code>
    </td>
    
    <td>
      <code>
        EquipmentDevice
      </code>
    </td>
    
    <td>
      The action button in a row was pressed.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        add
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Add device was pressed.
    </td>
  </tr>
</tbody>
</table>

## Accessibility

- Each row is a button with `aria-expanded` and `aria-controls`. Closed details are `inert`, so they are skipped by Tab.
- The All / Alerts switch is a `role="tablist"`; the arrow keys move between the two tabs.
- Level bars are `role="meter"` with `aria-valuenow`, and every LCD readout has an `aria-label` with its value and unit.
- The live drift and the transitions stop when the user prefers reduced motion or the card is off screen.
