Ghosty Search

Display search examples that mimic a user typing 👻🔍
Ghosty Search is like a slideshow for your search box but instead of images you'll see rotating suggestions.
Each of the suggestions look like they're being typed by another human (the "ghost").
You'll see randomised time on each simulated keystroke, higher speed deletions and even a typo here and there.
See the Codepen demo for an example using CSS and HTML.

Usage
yarn add ghostysearch
npm install ghostysearch
Simple Example
import GhostySearch from 'ghostysearch';
new GhostySearch({
inputElement: document.querySelector('.js-ghosty'),
suggestions: [],
wrapElement: document.querySelector('.js-ghosty-wrap'),
wrapClasses: {
finished: 'is-finished',
thinking: 'is-thinking',
typing: 'is-typing',
finished: 'is-finished',
deleting: 'is-deleting',
focussed: 'is-focussed',
destroyed: 'is-destroyed',
},
baseSpeed: 65,
randomness: 4,
pauseBefore: 1000,
pauseAfter: 1500,
oopsyFrequency: 0,
});
Features
- It's highly configurable, customise it all
- Events are fired to cover every action
- It's lightweight;
8kb
minified
- There's zero dependencies
- You'll be 100% cooler for using it 😎
Browser Support
Tested and ready for production in all modern browsers.
You can gain IE11+ support with a Object.assign polyfill (at the bottom of the page) and a CustomEvent polyfill.
Contribution
Contribution is welcome or open an issue and I'll tackle it.
License
MIT