A beautiful hover tilt effect component for Svelte 5, available as both a Svelte Component and Web Component.
Works with any framework or vanilla JavaScript via the Web Component.
[!NOTE] Looking for the
<HoverTilt />component documentation?
👉 View the hover-tilt package README for installation, usage, and API details.
npm install hover-tilt
# or
pnpm add hover-tilt
# or
yarn add hover-tilt
# or
bun add hover-tilt
<script>
import { HoverTilt } from 'hover-tilt';
</script>
<HoverTilt tiltFactor={1.5} scaleFactor={1.1}>
<div class="card">
Your content here
</div>
</HoverTilt>
Works in any framework or vanilla HTML:
<script type="module" src="node_modules/hover-tilt/dist/hover-tilt.js"></script>
<hover-tilt tilt-factor="1.5" scale-factor="1.1">
<div class="card">
Your content here
</div>
</hover-tilt>
<template>
<hover-tilt tilt-factor="1.5" scale-factor="1.1">
<div class="card">
Your content here
</div>
</hover-tilt>
</template>
<script setup>
// Import the web component
import 'hover-tilt/dist/hover-tilt.js';
</script>
import 'hover-tilt/dist/hover-tilt.js';
function MyComponent() {
return (
<hover-tilt tilt-factor="1.5" scale-factor="1.1">
<div className="card">
Your content here
</div>
</hover-tilt>
);
}
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="module" src="node_modules/hover-tilt/dist/hover-tilt.js"></script>
<hover-tilt tilt-factor="1.5" scale-factor="1.1">
<div class="card">Your content here</div>
</hover-tilt>
This repository is a monorepo containing:
packages/hover-tilt - The main library packageapps/docs - Documentation site built with Astro + Starlight# Install dependencies
pnpm install
# Run dev server for packages only (library)
pnpm dev
# Run dev servers for all packages and apps (library, docs)
pnpm dev:all
# Build packages only
pnpm build
# Build all packages and apps
pnpm build:all
# Lint packages only
pnpm lint
# Lint all packages and apps
pnpm lint:all
# Format packages only
pnpm format
# Format all packages and apps
pnpm format:all
# Type check packages only
pnpm check
# Type check all packages and apps
pnpm check:all
If you need to run a specific package directly:
# Library
pnpm --filter hover-tilt dev
# Documentation
pnpm --filter ./apps/docs dev
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
MPL-2.0
Simon Goellner (@simeydotme)