# Segment Display

Seven-segment LCD digits for live readings, clocks and meters. Every cell shows a faint unlit `8` behind the lit segments, lit segments glow, and decimal points fold into the digit before them. The display is one SVG that scales with the font size.

<demo-segment-display>



</demo-segment-display>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import SegmentDisplay from '~/components/ui/segment-display/SegmentDisplay.vue';
</script>

<template>
  <SegmentDisplay value="4.82" color="#f59e0b" class="text-6xl" />
</template>
```

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        value
      </code>
    </td>
    
    <td>
      <code>
        string | number
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Text to show. Digits, <code>
        -
      </code>
      
      , <code>
        _
      </code>
      
      , space, <code>
        .
      </code>
      
      , <code>
        :
      </code>
      
       and the letters A–F, H, L, P, U.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        digits
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Pads on the left with unlit cells to at least this many digits.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        color
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'currentColor'
      </code>
    </td>
    
    <td>
      Colour of the lit segments.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ghost
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0.12
      </code>
    </td>
    
    <td>
      Opacity of the unlit segments.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        glow
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Adds a soft glow around lit segments.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        slant
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        6
      </code>
    </td>
    
    <td>
      Slant in degrees. Positive values lean right.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      value
    </td>
    
    <td>
      Accessible label read by screen readers.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        class
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Extra classes. Set a font size such as <code>
        text-6xl
      </code>
      
       to size the display.
    </td>
  </tr>
</tbody>
</table>

## Accessibility

- The display is an `svg` with `role="img"` and an `aria-label`, so screen readers read the value, not the segments.
- Pass a `label` that names the reading, for example `label="Battery level"`.
- Segment changes fade over 150 ms and switch instantly when the user prefers reduced motion.
