DocsExplore
Get started

Search Subtly documentation

Search by a task, helper name or framework.

Explore

Live playground

These examples run the installed npm package. Requests and saves are simulated locally. No account or external service is required. Hover checks are labeled when they need a desktop mouse or trackpad.

Submenus, keyboard menus, link preloading and returning to a previous list position.

Find a menu item by typing

typeahead()

Focus a destination, then type “p” to jump to Poland. Press “p” again to cycle to Portugal. Type “net” quickly to reach Netherlands. Arrow keys also work.

Focus a destination, then type its name.

Actual npm package · local demonstration
Implementation and API

Hover & overlays

Hover previews, tooltips, popovers, outside clicks, scroll locking and dragging.

Start dragging after clear movement

dragIntent()

Move the task handle slightly, then drag deliberately. Dragging starts after 8 px. Focus the same handle and use arrow keys to move it without dragging.

Move more than 8 px to start dragging.

Actual npm package · local demonstration
Implementation and API

Keep popovers inside the screen

floating()

Open the panel, change its preferred placement, then resize the browser or move the anchor close to an edge. The panel flips, shifts and shrinks to stay visible.

Panel closed

Actual npm package · local demonstration
Implementation and API

Open a preview after a deliberate hover

hoverIntent()

Move quickly across the project button, then rest on it. The project preview opens after 150 ms of deliberate hover. You can also focus or click the button.

Preview closed. Hover, focus or click to open.

Actual npm package · local demonstrationHover timing needs a desktop pointer
Implementation and API

Stop the page moving behind a dialog

lockScroll()

Open the sample dialog and try scrolling the page behind it. Close the dialog to restore page scrolling. Escape also closes it.

Overlay behaviorKeep the page in place

Scroll the page a little before opening to check that its position is preserved.

A focused moment

The page behind this dialog is locked. The dialog uses native modal focus behavior.

Page scrolling is available.

Actual npm package · local demonstration
Implementation and API

Close a popover after an outside click

outsidePress()

Open the filters panel, change a checkbox, then click elsewhere. Inside interactions keep it open. Escape also closes the panel and returns focus to its trigger.

Filters closed.

Actual npm package · local demonstration
Implementation and API

Show hints on toolbar buttons

tooltipGroup()

Hover a formatting button. The first hint waits 500 ms; moving to a neighboring button shows its hint immediately. Keyboard focus always shows the hint immediately.

Good writing starts with a small idea.

Hover or focus a formatting button.

Actual npm package · local demonstrationHover timing needs a desktop pointer
Implementation and API

Forms & drafts

Field errors, input cleanup, draft recovery and unsaved-change warnings.

Restore a form after an interruption

draftRecovery()

Write a sample project title and note, save the draft, then clear the editor. Restore brings your text back from this tab’s session storage. Delete draft removes the stored copy.

Project note

No changes saved in this example yet.

Actual npm package · local demonstration
Implementation and API

Show an error after someone edits a field

fieldValidation()

Enter “hello”, then move out of the email field. An error appears after blur. Correct it to “hello@example.com” and the error clears as you type.

Newsletter signup

A sample form. No email is sent.

Start typing, then leave the field.

Actual npm package · local demonstration
Implementation and API

Move to the first invalid field

focusInvalid()

Submit the empty project form. Focus moves to the first missing field. Fill the title, submit again and focus moves to the email field.

Both fields are required. Nothing is submitted.

Actual npm package · local demonstration
Implementation and API

Clean up common input formatting

normalize()

Choose a format, edit the sample value and normalize it. Compare the original with the output. Formatting cleanup does not verify that an address or phone number is valid.

Cleaned outputWaiting for input

Choose a format, then normalize.

Actual npm package · local demonstration
Implementation and API

Warn before leaving unsaved edits

unsavedChanges()

Edit the project note to enable the guard, then save to disable it. After editing, you can use the test link to try leaving. Your browser chooses whether to show a confirmation.

All changes saved
Test leaving this page

The navigation guard is off.

Actual npm package · local demonstration
Implementation and API

Search & loading

Responsive search, current results, useful loading states and deferred content.

Search after typing pauses

debounce()

Search this local reading list. Type “design” and watch the list update after you stop typing for 300 ms. The counter shows how much filtering actually ran.

  • 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
Implementation and API

Ignore outdated search responses

latestRequest()

Load Design, then immediately load Engineering. Design is deliberately slower. Only the most recently requested team can appear, even when the earlier request finishes later.

Selected teamNo team loaded

Older results will never replace your latest selection.

Choose a team.

Actual npm package · local demonstration
Implementation and API

Avoid flashes from very short loading states

loadingIndicator()

Load the report with a fast or slow connection. Both requests show a busy state immediately, but only the longer request displays the spinner after 200 ms.

Activity report

Choose a request speed.

Actual npm package · local demonstration
Implementation and API

Load content as it nears the screen

nearViewport()

Scroll inside the panel until the deferred report comes into view. It initializes once, when it reaches the visible area. The rest of the page stays usable throughout.

Project overview

Keep scrolling inside this panel to load the secondary report.

Report not initialized

Waiting for the report to enter view.

Actual npm package · local demonstration
Implementation and API

Prevent repeat submissions while saving

singleFlight()

Click Save preferences several times during the one-second request. The button stays available so you can test repeated input, but the request counter increases only once.

Newsletter preferencesProduct updates, once a month

Repeated clicks share one pending save.

Requests started 0Save state Idle

Ready to save.

Actual npm package · local demonstration
Implementation and API

Show previous results while refreshing

staleCache()

Load the project summary twice within two seconds. The second read uses the cache. Wait longer and load again: the previous version appears while a fresh one is requested.

Project summaryNo summary loaded

Cache is empty.

Server reads 0Cache lifetime 2 seconds

Ready to load.

Actual npm package · local demonstration
Implementation and API

Feedback & undo

Instant updates, undo windows and screen-reader announcements.

Read updates aloud to screen readers

liveAnnouncer()

Add a sample item to the basket. The count updates visually and the same useful update is announced politely to a screen reader without moving your focus.

Sample productEveryday notebook

Illustrative basket. No purchase is made.

Basket 0 items
Actual npm package · local demonstration
Implementation and API

Show a change before the server replies

optimistic()

Save this article. Its appearance changes immediately, before the simulated server confirms. Turn on “Simulate a failed save” to see the previous state restored.

5 minute readDesigning for the in-between

The details between an action and its result.

Article is not saved.

Actual npm package · local demonstration
Implementation and API

Let someone undo a recent change

undoAction()

Archive the sample task. It disappears immediately and you have five seconds to undo. The final commit here only updates this local demo.

Review the landing pageDesign · Today
To do

One task in your list.

Actual npm package · local demonstration
Implementation and API

Keyboard & motion

Keyboard focus, input type and motion preferences.

Return focus to the dialog opener

captureFocus()

Open the project settings dialog and close it with its button or Escape. Notice the focus ring returning to the control that opened it.

Project settingsWebsite redesign

Open the dialog using the keyboard to follow the focus ring.

Project settings

This native dialog manages its own modal focus.

Ready. Focus will return to the opener.

Actual npm package · local demonstration
Implementation and API

Detect keyboard, mouse or touch input

inputModality()

Click or tap the sample button, then press Tab. The input card reflects the latest input type. Use this to adapt focus presentation without hiding useful feedback.

Waiting for inputMost recent input method

Click, tap or press a key.

Actual npm package · local demonstration
Implementation and API

Let an animation reverse smoothly

interruptibleMotion()

Expand the details, then collapse them before the transition finishes. The visual reverses from its current position instead of jumping back or queuing animations.

Collapsed. Try toggling quickly.

Actual npm package · local demonstration
Implementation and API

Follow the reduced-motion setting

motionPreference()

Play the sample transition. Its duration follows your system’s reduced-motion setting. Change that setting to see the value update while this page stays open.

System preference CheckingAnimation duration Checking

Follows your system setting.

Actual npm package · local demonstration
Implementation and API

Move through a toolbar with arrow keys

rovingFocus()

Tab into the text alignment toolbar once, then use Left, Right, Home or End to move between controls. Activate a button to update the sample text.

Small details make a familiar interface feel easier to use.

Left alignment. Tab into the toolbar to begin.

Actual npm package · local demonstration
Implementation and API