# Curved Drawer

> Slide-in drawer whose inner edge bulges with velocity via SVG path morphing, settling straight at rest.

<demo-curved-drawer>



</demo-curved-drawer>

## Installation

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

## Usage

```vue
<script setup lang="ts">
  import { ref } from 'vue';
  import CurvedDrawer from '~/components/ui/curved-drawer/CurvedDrawer.vue';

  const open = ref(false);
</script>

<template>
  <div class="relative overflow-hidden">
    <button @click="open = !open">Open drawer</button>

    <CurvedDrawer v-model="open" side="right" :width="320">
      <div class="p-6">Drawer content</div>
    </CurvedDrawer>
  </div>
</template>
```

The drawer is positioned absolutely inside its nearest relative ancestor.
A custom spring integrator drives the slide, and its velocity feeds an SVG
quadratic path on the inner edge — the faster the panel moves, the deeper
the bulge; when the spring settles the edge flattens back to a straight
line.

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        v-model
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Open state
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        side
      </code>
    </td>
    
    <td>
      <code>
        'left' | 'right'
      </code>
    </td>
    
    <td>
      <code>
        'right'
      </code>
    </td>
    
    <td>
      Edge the drawer slides from
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        width
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        380
      </code>
    </td>
    
    <td>
      Panel width in px
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        max-bulge
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        48
      </code>
    </td>
    
    <td>
      Maximum curve depth in px
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        stiffness
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        170
      </code>
    </td>
    
    <td>
      Spring stiffness
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        damping
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        22
      </code>
    </td>
    
    <td>
      Spring damping
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        overlay
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Dimming backdrop that closes on click
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        background
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        var(--background)
      </code>
    </td>
    
    <td>
      Panel + curve fill color
    </td>
  </tr>
</tbody>
</table>
