v0.1.2Small interaction primitives

The little things.
A lot better.

Menus that don’t close too soon. Forms that remember your work. Feedback that arrives at the right time.

Subtly adds thoughtful behavior to the components you already have. Use plain JavaScript or your favorite framework.

npm install subtly
29 helpersPlain JavaScriptWorks with your framework
A small detail, in action

Errors when they’re helpful.

Try an incomplete email, then leave the field. Correct it and watch the error clear.

Newsletter signup

A sample form. No email is sent.

Start typing, then leave the field.

fieldValidation() waits for interaction, then helps people correct the input.

What it does

Better behavior.
Still your interface.

Choose an interaction to improve. Subtly handles the timing and input details, while your application controls the rendering and styling.

Try it yourself

See the difference.
Then use the code.

Real library behavior, familiar little interfaces. Requests and saves are simulated locally so you can experiment freely.

debounce()

Search after a pause

Keep the input immediate. Wait for a pause before doing the work.

Implementation guide
  • Designing a useful empty state
  • Accessible menus from the start
  • Small details in product design
  • A guide to loading feedback

4 articles · 0 filter runs

Actual npm package · local demonstration
undoAction()

Give mistakes an undo

Archive a task, then bring it back before the local action is confirmed.

Implementation guide
Review the landing pageDesign · Today
To do

One task in your list.

Actual npm package · local demonstration
Find a starting point

What would you like
to make easier?

Browse by the problem you want to solve. Every helper includes a working example, setup, lifecycle and safety notes.

Browse all 29 helpers
From example to implementation

A small addition
to your existing project.

Install

Add the package

Install from npm, then import the helpers you need.

Terminal
npm install subtly
Connect

Start with one behavior

Use a direct JavaScript import or the six built-in HTML behaviors.

JavaScript
import { debounce } from 'subtly';
const search = debounce(findArticles, 300);
input.addEventListener('input', event => {
search(event.target.value);
});
// When the component is removed:
search.cancel();
Make it yours

Use your component lifecycle

Initialize after the elements exist. Clean up when the component unmounts. The framework guides show where both belong.

Use Subtly with React
Your stack is welcome

Familiar tools.
One small library.

Plain HTML, React, Laravel, Vue and more. Start with the guide for the framework you already use.

HTML, when that is enough

Declare the behavior.
Keep your own styling.

Use data attributes for common behavior and explicit JavaScript when your application needs control.

HTML
<div data-ix="hover-intent" data-ix-hover-delay="150">
<button type="button">Preview</button>
</div>

Start createInteractions() once and handle its emitted events in your component. Subtly does not render the preview for you.

Explore the HTML API
Ready when you are

Add the behavior.
Keep your interface.

Choose one helper and connect it to a component you already have.

Get started with Subtly