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 🙏

© 2026 – Pkg Stats / Ryan Hefner

magicaret

v1.0.0

Published

A beautiful and smooth animated caret library for web applications

Readme

Magicaret

A beautiful and smooth animated caret library for web applications. Transform your input caret into a custom caret with beautiful styles and smooth animations.

Live Demo npm License

Features

  • Multi-framework Support: Vanilla JS, React, and Vue
  • Easy to Use: Simple API with no dependencies
  • Beautiful Styles: Default gradient colors with several built-in styles
  • Smooth Animations: Animates caret position smoothly with comet trail effects
  • Customizable: Customize color, size, animation, and more
  • TypeScript Support: Full TypeScript support included

Installation

pnpm install magicaret

Vanilla JS Usage

import { Magicaret } from 'magicaret'

const input = document.getElementById('my-input')
const magicaret = new Magicaret(input, {
  style: 'rainbow',
  size: 3,
  trailLength: 15
})

// Update options later
magicaret.updateOptions({
  style: 'neon'
})

// Clean up
magicaret.destroy()

React Usage

Using the useMagicaretDirective hook

import { useMagicaretDirective } from 'magicaret/react'

function App() {
  const nameRef = useMagicaretDirective({
    style: 'rainbow',
    size: 3
  })

  return <input ref={nameRef} placeholder="Type something..." />
}

Multiple inputs with same options

import { useMagicaretDirective } from 'magicaret/react'

function App() {
  const inputRef = useMagicaretDirective({ style: 'neon' })

  return (
    <div>
      <input ref={inputRef} placeholder="Name" />
      <input ref={inputRef} placeholder="Email" />
      <textarea ref={inputRef} placeholder="Message" />
    </div>
  )
}

Vue Usage

Using the v-magicaret directive

<template>
  <input
    v-magicaret="{ style: 'rainbow', size: 3 }"
    placeholder="Type something..."
  />
</template>

<script setup>
import { vMagicaret } from 'magicaret/vue'
</script>

Multiple inputs with same options

<template>
  <div>
    <input
      v-magicaret="{ style: 'neon' }"
      placeholder="Name"
    />
    <input
      v-magicaret="{ style: 'neon' }"
      placeholder="Email"
    />
    <textarea
      v-magicaret="{ style: 'neon' }"
      placeholder="Message"
    />
  </div>
</template>

<script setup>
import { vMagicaret } from 'magicaret/vue'
</script>

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | color | string \| string[] | undefined | Custom color or array of colors for gradient | | size | number | 2 | Width of the caret in pixels | | animationDuration | number | 150 | Duration of caret animation in milliseconds | | trailLength | number | 10 | Number of trail particles | | trailOpacity | number | 0.5 | Opacity of trail particles (0-1) | | trailWidth | number | 2 | Width of trail particles | | style | string | 'default' | Built-in style preset |

Built-in Styles

  • default - Purple to indigo gradient
  • neon - Green to cyan gradient
  • rainbow - Full rainbow gradient
  • fire - Red to orange to yellow gradient
  • ocean - Light blue to dark blue gradient
  • purple - Purple gradient
  • green - Green gradient
  • pink - Pink gradient

Custom Colors

You can also use custom colors:

const magicaret = new Magicaret(input, {
  color: '#ff0000' // Single color
})

// Or gradient
const magicaret = new Magicaret(input, {
  color: ['#ff0000', '#00ff00', '#0000ff'] // Gradient
})

Examples

Simple input with neon style

const input = document.getElementById('my-input')
new Magicaret(input, { style: 'neon' })

Large caret with long trail

const magicaret = new Magicaret(input, {
  size: 4,
  trailLength: 20,
  trailOpacity: 0.7
})

Custom gradient colors

const magicaret = new Magicaret(input, {
  color: ['#ff6b6b', '#feca57', '#48dbfb']
})

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.