UNPKG

vue-zoomster

Version:

A Vue 2 component for image zoom, rotate, and download

123 lines (95 loc) β€’ 2.99 kB
# πŸ“¦ vue-zoomster A Vue 2 component for image **zoom**, **rotate**, **drag**, and **download**, powered by GSAP. No bloat, just vibes. Works great for receipts, galleries, or anything you wanna inspect closer. --- ## πŸš€ Features - πŸ” Zoom In / Out - πŸ”„ Rotate Left / Right - πŸ–±οΈ Drag to Move (GSAP Draggable) - πŸ“₯ Download Image - πŸ’‘ Responsive Layout - πŸ“¦ Lightweight – no Bootstrap or CSS frameworks --- ## πŸ“¦ Installation ```bash npm install vue-zoomster gsap ``` --- ## ▢️ Usage > πŸ’‘ Don’t forget to **import the CSS** manually: ```js import "vue-zoomster/dist/ZoomSter.css"; ``` ### βœ… Single Image Example ```vue <template> <div> <ZoomSter :preview-image="'https://your-image-url.com/image.jpg'" :radius="'12px'" :ratio="'16/9'" :width="'100%'" :height="'auto'" :downloadable="true" /> </div> </template> <script> import { ZoomSter } from "vue-zoomster"; import "vue-zoomster/dist/ZoomSter.css"; // required! export default { components: { ZoomSter, }, }; </script> ``` --- ### πŸ” `v-for` Multiple Images Example ```vue <template> <div class="gallery"> <ZoomSter v-for="(img, idx) in images" :key="`zoom-${idx}`" :preview-image="img" :image-id="`img-${idx}`" :radius="'8px'" :ratio="'4/3'" :downloadable="true" /> </div> </template> <script> import { ZoomSter } from "vue-zoomster"; import "vue-zoomster/dist/ZoomSter.css"; // required! export default { components: { ZoomSter, }, data() { return { images: [ "https://yourdomain.com/img1.jpg", "https://yourdomain.com/img2.jpg", "https://yourdomain.com/img3.jpg", ], }; }, }; </script> ``` --- ## βš™οΈ Props | Prop | Type | Default | Description | | -------------- | ------- | -------- | ---------------------------------------------------------------------- | | `radius` | String | `"0"` | Border radius of the thumbnail container. Accepts any valid CSS value. | | `ratio` | String | `"16/9"` | Aspect ratio of the preview image. E.g. `"4/3"`, `"1/1"`, etc. | | `previewImage` | String | `""` | URL or path to the image you want to preview. | | `imageId` | String | `""` | Unique ID for the image preview instance. Required if using `v-for`. | | `width` | String | `"100%"` | Width of the image preview container. Accepts any valid CSS value. | | `height` | String | `"auto"` | Height of the image preview container. Accepts any valid CSS value. | | `downloadable` | Boolean | `false` | If `true`, shows a download button in the viewer modal. | --- ## πŸ™ Credits Icons by [Icons8](https://icons8.com)