0.0.115 • Published 3 months ago
@solid-primitives/cursor v0.0.115
@solid-primitives/cursor
Two simple primitives for setting cursor css property reactively.
createElementCursor
- Set provided cursor to given HTML Element styles reactively.createBodyCursor
- Set selected cursor to body element styles reactively.
Installation
npm install @solid-primitives/cursor
# or
yarn add @solid-primitives/cursor
# or
pnpm add @solid-primitives/cursor
createElementCursor
Set provided cursor to given HTML Element styles reactively.
It takes two arguments:
element
- HTMLElement or a reactive signal returning one. Returning falsy value will unset the cursor.cursor
- Cursor css property. E.g. "pointer", "grab", "zoom-in", "wait", etc.
import { createElementCursor } from "@solid-primitives/cursor";
const target = document.querySelector("#element");
const [cursor, setCursor] = createSignal("pointer");
const [enabled, setEnabled] = createSignal(true);
createElementCursor(() => enabled() && target, cursor);
setCursor("help");
createBodyCursor
Set selected cursor to body element styles reactively.
It takes only one argument:
cursor
- Signal returing a cursor css property. E.g. "pointer", "grab", "zoom-in", "wait", etc. Returning falsy value will unset the cursor.
import { createBodyCursor } from "@solid-primitives/cursor";
const [cursor, setCursor] = createSignal("pointer");
const [enabled, setEnabled] = createSignal(true);
createBodyCursor(() => enabled() && cursor());
setCursor("help");
Changelog
See CHANGELOG.md
0.0.115
3 months ago
0.0.114
3 months ago
0.0.113
4 months ago
0.0.112
10 months ago
0.0.111
1 year ago
0.0.110
1 year ago
0.0.106
1 year ago
0.0.109
1 year ago
0.0.108
1 year ago
0.0.107
1 year ago
0.0.107-beta.0
1 year ago
0.0.105
1 year ago
0.0.104
1 year ago
0.0.103
2 years ago
0.0.102
2 years ago
0.0.101
2 years ago
0.0.100
2 years ago