尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
Animated skeleton loader for React, Next.js, Vue, Svelte and plain JS. Draws a loading skeleton in your real layout. Light and dark, no dependencies.
翻译准备中
正在加载完整 README。
查看完整 README ↗Crosshair Skeleton is a skeleton loader (a skeleton screen) and an attention effect: use it to highlight one supporting element on a landing page, or as the loading state of a block that waits on data. Crosshair corners lock onto the element, a grid maps it, and cursors select every element inside, size labels and all, leaving a skeleton block in its exact shape. When the data lands, the real content swaps in element by element: no shimmer, no layout jump. This repository is the whole thing: one dependency-free ES module, adapters for React and Next.js, Vue and Svelte, and an agent skill for Claude Code and Codex.
auto, it plays once when a hero visual, an image or a bento card scrolls into view, then shows the content after a short pause. No data needed.inert and aria-busy while loading, reduced motion gets a static skeleton, and nothing is left in the DOM afterwards.| Drawing: cursors select each element | Waiting, in dark mode |
|---|---|
It is a cosmetic effect that draws the eye, so restraint is the point:
The full rules, with what to use instead, are in SKILL.md.
npm install crosshair-skeleton
Or copy crosshair-skeleton.js into your project. It is one file.
Copy this folder into your agent's skills directory:
| Agent | Folder |
|---|---|
| Claude Code | ~/.claude/skills/crosshair-skeleton/ (or .claude/skills/ in a project) |
| Codex | ~/.codex/skills/crosshair-skeleton/ |
Others that read SKILL.md | Their skills folder |
Agents applying the skill should follow AGENT-GUIDE.md: the integration procedure, pitfalls seen on production UI, and a browser verification checklist.
import { crosshair } from "crosshair-skeleton";
const card = document.querySelector("#revenue");
const skeleton = crosshair(card); // loading starts
renderRevenue(card, await getRevenue()); // real content in place, still hidden
await skeleton.done(); // revealed, overlay removed
Declarative, for any framework or server-rendered HTML:
<section data-crosshair="loading" data-crosshair-reveal="flow">…</section>
<script type="module">
import { watch } from "./crosshair-skeleton.js"; // or "crosshair-skeleton" with a bundler
watch(); // set data-crosshair to anything else to reveal
</script>
// React, Next.js, Remix, Preact
import { useCrosshair } from "crosshair-skeleton/react";
const ref = useCrosshair(!data); // <div ref={ref}>…</div>
<!-- Vue, Nuxt: app.use(CrosshairSkeleton) from "crosshair-skeleton/vue" -->
<div v-crosshair="!data">…</div>
<!-- Svelte, SvelteKit: import { skeleton } from "crosshair-skeleton/svelte" -->
<div use:skeleton={!data}>…</div>
Each adapter is tested against the real framework: the skeleton appears, the real data is revealed, a reload restarts it and an unmount mid-load leaves nothing behind. Tested: React 19 (Strict Mode), Preact 10, Vue 3.5, Svelte 5, Solid 1.9, Lit 3 (shadow DOM), Alpine 3 and htmx 2. React and Vue also server-render cleanly (Next.js, Nuxt). Solid, Angular, Lit, Astro, Alpine and htmx patterns, every option, part hints and theming are in SKILL.md.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗