npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bottom-sheet-vue3

v2.0.5

Published

A touch-supported bottom sheet library for Vue 3

Downloads

2,424

Readme

Bottom-Sheet-Vue3

A touch-supported bottom sheet library for Vue 3

Installation

pnpm install bottom-sheet-vue3
yarn install bottom-sheet-vue3
npm install bottom-sheet-vue3

Usage

Import css and register plugin. Plugin is needed.

import { createBottomSheet } from 'bottom-sheet-vue3'
import { createApp } from 'vue'

import 'bottom-sheet-vue3/style.css'
import App from './App.vue'

const app = createApp(App)
app.use(createBottomSheet())
app.mount('#app')

Sheet is just a single component with slots/options support. It teleports itself to body so you can use it anywhere you want.

<script lang="ts" setup>
import { ref } from 'vue'
import { Sheet } from 'bottom-sheet-vue3'

const visible = ref(false)
</script>

<template>
  <button @click="visible = true">
    Click to show sheet
  </button>

  <Sheet v-model:visible="visible">
    Hello this is Sheet Content
  </Sheet>
</template>

Custom Header

You can set custom header if you don't want default line header.

<script lang="ts" setup>
import { ref } from 'vue'
import { Sheet } from 'bottom-sheet-vue3'

const visible = ref(false)
</script>

<template>
  <button @click="visible = true">
    Click to show sheet
  </button>

  <Sheet v-model:visible="visible">
    Hello this is Sheet Content

    <template #header>
      <SomeComponent />
    </template>
  </Sheet>
</template>

Props

interface Props {
  /**
   * @description Minimum swipe down pixel count for sheet to close itself
   *
   * @default { 100 }
   */
  threshold: number

  /**
   * @description By default sheet listens swipe on screen, if
   *              this prop given it will listen only header.
   *
   * @default { false }
   */
  onlyHeaderSwipe: boolean

  /**
   * @description By default sheet stretches itself up over-swipe,
   *              this prop disables it
   *
   * @default { false }
   */
  noStretch: boolean

  /**
   * @description If given Sheet won't close itself on click outside
   *
   * @default { false }
   */
  noClickOutside: boolean

  /**
   * @description Removes header section, ignores #header slot
   *
   * @default { false }
   */
  noHeader: boolean

  /**
   * @description Handles sheet visibility, should be used as `v-model:visible`.
   */
  visible: boolean
}

Styling Sheet

You can directly change css properties but Sheet provides some css variables for you to override default ones.

  • --bottom-sheet-backdrop-background-color

    • @default rgba(0, 0, 0, 0.2)
  • --bottom-sheet-max-width

    • @default 500px
  • --bottom-sheet-bakground-color

    • @default #fff
  • --bottom-sheet-min-width

    • @default 40%
  • --bottom-sheet-max-height

    • @default 60%
  • --bottom-sheet-border-radius

    • @default 15px 15px 0px 0px
  • --bottom-sheet-header-bar-background-color

    • @default rgb(88, 88, 88)
  • --bottom-sheet-header-bar-border-radius

    • @default 10px