DocsStart here
Get started

Search Subtly documentation

Search by a task, helper name or framework.

Start here

Installation

Subtly is published on npm. Add it to your project and import only the helpers you need.

Terminal
npm install subtly

Initialize the HTML behaviors

JavaScript
import { createInteractions } from "subtly";
import "subtly/styles.css"; // optional structural styles
const interactions = createInteractions();
interactions.start();
// At application teardown:
interactions.stop();

Use a standalone utility

Utilities can be imported directly when you need programmatic control.

JavaScript
import { hoverIntent, debounce } from "subtly";

Optional floating positioning

The floating helper uses Floating UI as an optional peer dependency. Install it only when using that helper.

Terminal
npm install @floating-ui/dom
JavaScript
import { floating } from "subtly/floating";

Without a bundler

Copy the src/ directory into your site and use native module imports. Serve the site over HTTP so browser modules can load.

HTML
<script type="module">
import { createInteractions } from "./interactions/index.js";
const interactions = createInteractions();
interactions.start();
</script>