All skills
onmax avatar

/vueuse-functions

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/vueuse-functions

This session only. Nothing lands on disk.

referencesuseClipboard.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

useClipboard

Reactive Clipboard API. Provides the ability to respond to clipboard commands (cut, copy, and paste) as well as to asynchronously read from and write to the system clipboard. Access to the contents of the clipboard is gated behind the Permissions API. Without user permission, reading or altering the clipboard contents is not permitted.

<CourseLink href="https://vueschool.io/lessons/reactive-browser-wrappers-in-vueuse-useclipboard?friend=vueuse">Learn how to reactively save text to the clipboard with this FREE video lesson from Vue School!</CourseLink>

Usage

<script setup lang="ts">
import { useClipboard } from '@vueuse/core'

const source = ref('Hello')
const { text, copy, copied, isSupported } = useClipboard({ source })
</script>

<template>
  <div v-if="isSupported">
    <button @click="copy(source)">
      <!-- by default, `copied` will be reset in 1.5s -->
      <span v-if="!copied">Copy</span>
      <span v-else>Copied!</span>
    </button>
    <p>Current copied: <code>{{ text || 'none' }}</code></p>
  </div>
  <p v-else>
    Your browser does not support Clipboard API
  </p>
</template>

Options

Option Type Default Description
source MaybeRefOrGetter<string> — Default content to copy when copy() is called without arguments
read boolean false Enable reading clipboard content on copy/cut events
copiedDuring number 1500 Milliseconds before copied resets to false
legacy boolean false Fallback to document.execCommand if Clipboard API unavailable

Return Values

Property Type Description
isSupported ComputedRef<boolean> Whether clipboard is supported (native or legacy)
text Ref<string> Current clipboard content (when read: true)
copied Ref<boolean> true after successful copy, auto-resets
copy (text?: string) => Promise<void> Copy text to clipboard

Legacy Mode

Set legacy: true to keep the ability to copy if Clipboard API is not available. It will handle copy with execCommand as fallback.

const { copy, isSupported } = useClipboard({ legacy: true })

Component Usage

<template>
  <UseClipboard v-slot="{ copy, copied }" source="copy me">
    <button @click="copy()">
      {{ copied ? 'Copied' : 'Copy' }}
    </button>
  </UseClipboard>
</template>

Type Declarations

export interface UseClipboardOptions<Source> extends ConfigurableNavigator {
  /**
   * Enabled reading for clipboard
   *
   * @default false
   */
  read?: boolean
  /**
   * Copy source
   */
  source?: Source
  /**
   * Milliseconds to reset state of `copied` ref
   *
   * @default 1500
   */
  copiedDuring?: number
  /**
   * Whether fallback to document.execCommand('copy') if clipboard is undefined.
   *
   * @default false
   */
  legacy?: boolean
}
type ClipboardValue = string | (() => Promise<string | undefined>)
export interface UseClipboardReturn<Optional> extends Supportable {
  text: Readonly<ShallowRef<string>>
  copied: Readonly<ShallowRef<boolean>>
  copyPending: Readonly<ShallowRef<boolean>>
  copy: Optional extends true
    ? (text?: ClipboardValue) => Promise<void>
    : (text: ClipboardValue) => Promise<void>
}
/**
 * Reactive Clipboard API.
 *
 * @see https://vueuse.org/useClipboard
 * @param options
 *
 * @__NO_SIDE_EFFECTS__
 */
export declare function useClipboard(
  options?: UseClipboardOptions<undefined>,
): UseClipboardReturn<false>
export declare function useClipboard(
  options: UseClipboardOptions<MaybeRefOrGetter<string>>,
): UseClipboardReturn<true>

Source: SKILL.md on GitHub

No alerts8d3 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill is a documentation and implementation guide for the VueUse library. It maps developer requirements to reactive composables. While the skill is a legitimate development tool, it provides a surface for indirect prompt injection by demonstrating the ingestion of untrusted data from sources like the clipboard and URL parameters without explicit sanitization patterns.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
metadata
{
  "author": "SerKo <https://github.com/serkodev>",
  "version": "1.0"
}
compatibility
Requires Vue 3 (or above) or Nuxt 3 (or above) project

README badge

README badge for onmax/nuxt-skills/vueuse-functions