# Nostalgia

> Vintage slide-viewer that cycles through memories while a fan of polaroid thumbnails arcs around it and a year + serif title crossfade underneath.

<demo-nostalgia>



</demo-nostalgia>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import Nostalgia from '~/components/ui/nostalgia/Nostalgia.vue';

  const items = [
    { src: '/photos/first-breath.jpg', year: '1988', title: 'First Breath' },
    { src: '/photos/six-candles.jpg', year: '1994', title: 'Six Candles' },
    { src: '/photos/the-sea.jpg', year: '1995', title: 'The Sea' },
  ];
</script>

<template>
  <Nostalgia :items="items" :interval="2600" autoplay monochrome />
</template>
```

Each memory shows in the viewer while the rest fan out as polaroids on both
sides — past memories to the left, upcoming to the right. Clicking a polaroid
jumps to it. `v-model` tracks the active index.

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        items
      </code>
    </td>
    
    <td>
      <code>
        NostalgiaItem[]
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Ordered memories (<code>
        src
      </code>
      
      , <code>
        year
      </code>
      
      , <code>
        title
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        v-model
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Active memory index
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        autoplay
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Auto-advance through memories
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        interval
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        2600
      </code>
    </td>
    
    <td>
      Milliseconds each memory stays on screen
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause-on-hover
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Pause autoplay while hovering
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        monochrome
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Render photos in black & white
    </td>
  </tr>
</tbody>
</table>

## Events

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

<tbody>
  <tr>
    <td>
      <code>
        change
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Fired on memory activation
    </td>
  </tr>
</tbody>
</table>

## Credits

Ported from the "nostalgia, as a component" exploration by
[@ozzyxs1a](https://x.com/ozzyxs1a/status/2074277530073264635).
