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.
29 helpersPlain JavaScriptWorks with your framework
A small detail, in actionErrors when they’re helpful.
Try an incomplete email, then leave the field. Correct it and watch the error clear.
Start typing, then leave the field.
fieldValidation() waits for interaction, then helps people correct the input.
What it doesBetter 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 yourselfSee 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 guideActual npm package · local demonstration
undoAction()Give mistakes an undo
Archive a task, then bring it back before the local action is confirmed.
Implementation guideReview the landing pageDesign · Today
To doTask archived.
One task in your list.
Actual npm package · local demonstration
menuAim()Keep the right submenu open
Move diagonally toward the panel. Click and keyboard work immediately.
The diagonal hover check needs a desktop mouse or trackpad. Click and keyboard also work.
Implementation guideActual npm package · local demonstrationHover timing needs a desktop pointer
Find a starting pointWhat 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 helpersFrom example to implementation
A small addition
to your existing project.
InstallAdd the package
Install from npm, then import the helpers you need.
ConnectStart with one behavior
Use a direct JavaScript import or the six built-in HTML behaviors.
import { debounce } from 'subtly';
const search = debounce(findArticles, 300);
input.addEventListener('input', event => {
search(event.target.value);
});
search.cancel();
Make it yoursUse 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 welcomeFamiliar 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 enoughDeclare the behavior.
Keep your own styling.
Use data attributes for common behavior and explicit JavaScript when your application needs control.
<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 APIReady when you areAdd the behavior.
Keep your interface.
Choose one helper and connect it to a component you already have.
Get started with Subtly