1.0.2 • Published 1 year ago

@appoly/vue-sheet v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Vue Sheet

A flexible, accessible, and customizable Sheet component for Vue 3. Inspired by Shadcn.

Features

  • Multiple positioning options (left, right, top, bottom)
  • Customizable width and height
  • Easy to use with v-model/prop binding
  • Escape key support
  • Customizable trigger and close buttons

Dependencies

  • Vue 3.x

Installation

npm install @appoly/vue-sheet
# or
yarn add @appoly/vue-sheet

Usage

Basic Usage

<template>
  <Sheet 
    v-model:open="isOpen"
    @update:open="isOpen = $event"
    position="right"
    :can-close="canClose"
  >
    <template #trigger>
      <button>Open Sheet</button>
    </template>
    
    <div>
      <!-- Your sheet content here -->
      Sheet content
    </div>
  </Sheet>
</template>

<script setup>
import { ref } from 'vue'
import { Sheet } from '@appoly/vue-sheet'
import '@appoly/vue-sheet/dist/style.css'

const isOpen = ref(false)
const canClose = () => {
  return confirm('Are you sure you want to close the sheet?')
}
</script>

Try it out on StackBlitz

Expandable

<template>
  <Sheet
    position="left"
    expandable
    :expand-default="true"
  >
    <template #trigger>
      <button>Open Sheet</button>
    </template>
    
    <div>
      <!-- Your sheet content here -->
      Sheet content
    </div>
  </Sheet>
</template>

Try it out on StackBlitz

Custom Buttons

<template>
  <Sheet 
    position="bottom"
  >
    <template #trigger>
      <button>Open Sheet</button>
    </template>
    
    <template #maximize>
      <button>Maximize</button>
    </template>
    
    <template #minimize>
      <button>Minimize</button>
    </template>
    
    <template #close>
      <button>Close</button>
    </template>
    
    <div>
      <!-- Your sheet content here -->
      Sheet content
    </div>
  </Sheet>
</template>

Try it out on StackBlitz

Props

PropTypeDefaultDescriptionAllowed Values
positionString"right"Sheet slide direction"left", "right", "top", "bottom"
widthString"500px"Width of sheet (when left/right)CSS width values (px, %, em, rem, vw, vh)
heightString"500px"Height of sheet (when top/bottom)CSS height values (px, %, em, rem, vw, vh)
maxWidthString"90%"Maximum width of sheetPercentage values
maxHeightString"90%"Maximum height of sheetPercentage values
openBooleanfalseControl sheet open statetrue/false
closeOnEscapeBooleantrueClose sheet when Escape is pressedtrue/false
noTriggerBooleanfalseDisable default triggertrue/false
canCloseFunction() => trueCustom function to determine if the sheet can be closedFunction returning boolean
expandableBooleanfalseAllow the sheet to be expandedtrue/false
expandDefaultBooleanfalseDefault expand state (true means expanded)true/false

Slots

  • trigger: Custom trigger element
  • close: Custom close button
  • maximize: Custom maximize button
  • minimize: Custom minimize button
  • Default slot: Sheet content
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.11

1 year ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago