Skip to the content

Cursor label

A word for the cursor, set on the element itself.

Create a free account to unlock it.

Sign up free

Already a member? Sign in

Documentation

  1. Copy to Webflow

    Add Geist and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed.

  2. Add custom CSS

    The stylesheet hides the system cursor over a labelled element while its pill shows, with !important, since a page gives its links a cursor of their own. Fields and frames inside a labelled element keep theirs.
  3. Add custom JS

  4. Use it on your own elements

    Custom attributes
    Select the element on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.
    Custom attributeWhat it does
    data-cursor-label="View" The pill says View while the pointer is over this element or anything inside it, and the system cursor is hidden there. On a project in the preview.
    data-cursor-label="Play" The pill says Play, the same way. On the film in the preview, where data-cursor-label-color and data-cursor-label-word-color on the same element make it cream with an ink word. Any other short word works the same way.
    data-cursor-label="" Empty, or the attribute with no value: the pill says the default word, the word setting, View unless it was changed.
    data-cursor-label-state Written by the engine on the html element: on while the pill shows, rest when it does not, off on a touch screen. Never written by hand; the stylesheet reads it to hide the system cursor over the labelled elements. [ Optional ]
    Any word is a value, and the pill takes its length. The stylesheet draws it in capitals.
    Settings
    Every setting is a custom attribute too, added the same way and on the same element. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-cursor-label-color #ffab1a Colour of the pill. Options: any CSS colour; taken out of this block, --cursor-label-color takes over, then the amber #ffab1a. On one element, data-cursor-label-color.
    data-cursor-label-word-color #15100c Colour of the word on the pill. Options: any CSS colour; taken out of this block, --cursor-label-word-color takes over, then the ink #15100c. On one element, data-cursor-label-word-color.
    data-cursor-label-word View The word of an element whose data-cursor-label is left empty. Options: any short word; the stylesheet sets it in capitals.
    data-cursor-label-font-size 10.5px Size of the word, any CSS unit; the pill grows with it.
    data-cursor-label-height 2.7 Height of the pill, in times fontSize.
    data-cursor-label-padding 1.3 Space on either side of the word, in times fontSize.
    data-cursor-label-lag 0.1 How long the pill takes to catch up with the pointer, in seconds.
    data-cursor-label-morph 0.3 How long the pill takes to grow, shrink, or ease to the width of a new word, in seconds.

What it does

Cursor label is a cursor animation for Webflow and vanilla JavaScript, with no library. Also called custom cursor with text on hover, view cursor on hover or cursor follower with label.

A word for the cursor, set on the element itself. Any element that carries data-cursor-label="View" (or Play, or any word) turns the cursor into a pill that says it while the pointer is over it, and follows the pointer with a little lag. The pill grows out of the pointer as it arrives and shrinks back into it as it leaves; from one labelled element straight to another it stays, its old word rolls up and out, the new one rolls in from below, and its width eases to the new word. It tightens a little under a press. Everywhere else the system cursor stays as it is. One script for the whole page, watching the document, so elements added later get their word too; one canvas over the window, clicks pass through, and the loop only runs while the pill moves. No pill at all on touch screens, and under reduced motion it follows at once and only fades.

Updated

Questions

Paste the component once, then give any element a custom attribute whose value is the word, for instance data-cursor-label="View" on a project card or data-cursor-label="Play" on a video. An empty value shows the default word, View. Everywhere else the system cursor stays as it is.

No. It is one script for the whole page with no library, drawing the pill on one canvas fixed over the window. Clicks pass through it, and the loop only runs while the pill moves.

Add data-cursor-label-color for the pill and data-cursor-label-word-color for the word on that element. The defaults are #ffab1a and #15100c. For a whole dark section, set the inherited custom properties --cursor-label-color and --cursor-label-word-color on it once.

No. Touch screens and coarse pointers get no pill and no layer at all, and the page behaves as if the script were not there. A device that gains or loses a mouse switches on the spot.

Yes. The script listens on the document with pointerover and closest(), so an element that gets the attribute later, a card loaded by a CMS or rendered by a framework, works without a call.