shadcn-hooks

Apply shadcn-hooks React hooks where appropriate to build concise, maintainable React features.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "shadcn-hooks" with this command: npx skills add debbl/shadcn-hooks/debbl-shadcn-hooks-shadcn-hooks

shadcn-hooks

This skill is a decision-and-implementation guide for shadcn-hooks in React projects. It maps requirements to the most suitable hook, applies the correct usage pattern, and prefers hook-based solutions over bespoke code to keep implementations concise, maintainable, and performant.

When to Apply

  • Apply this skill whenever assisting user development work in React / Next.js.
  • Always check first whether a shadcn-hooks function can fulfill the requirement.
  • Prefer shadcn-hooks over custom code to improve readability, maintainability, and performance.
  • Map requirements to the most appropriate hook and follow the hook's invocation rule.
  • Please refer to the Invocation field in the below functions table. For example:
    • AUTO: Use automatically when applicable.
    • EXTERNAL: Use only if the user already installed the required external dependency; otherwise reconsider, and ask to install only if truly needed.

Installation

Prefer the shadcn CLI — it copies only the hooks you need into your project (zero extra runtime dependencies, tree-shake friendly):

# Install a single hook (recommended)
npx shadcn@latest add @shadcnhooks/use-boolean

# Install multiple hooks at once
npx shadcn@latest add @shadcnhooks/use-boolean @shadcnhooks/use-mount @shadcnhooks/use-debounce

Alternatively, install the full npm package (all hooks bundled):

npm install shadcn-hooks

When using the shadcn CLI, import from the local path (e.g. import { useBoolean } from "@/hooks/use-boolean"). When using the npm package, import from "shadcn-hooks" (e.g. import { useBoolean } from "shadcn-hooks").

Functions

All functions listed below are part of shadcn-hooks. Each section categorizes functions based on their functionality.

IMPORTANT: Each function entry includes a short Description and a detailed Reference. When using any function, always consult the corresponding document in ./references for Usage details and Type Declarations.

State

FunctionDescriptionInvocation
useBooleanBoolean state with set, setTrue, setFalse, toggle helpersAUTO
useControllableValueSupports both controlled and uncontrolled component patternsAUTO
useCounterCounter with inc, dec, set, reset helpersAUTO
useDebounceDebounced reactive valueAUTO
useResetStateState with a reset function to restore the initial valueAUTO
useThrottleThrottled reactive valueAUTO
useToggleToggle between two values with utility actionsAUTO

Advanced

FunctionDescriptionInvocation
useCreationMemoized factory with deep dependency comparisonAUTO
useCustomCompareEffectuseEffect with a custom dependency comparatorAUTO
useLatestRef that always holds the latest valueAUTO
useLockFnPrevents concurrent execution of an async functionAUTO
useMemoizedFnStable function reference that never changes identityAUTO
usePreviousReturns the previous value of a stateAUTO

Lifecycle

FunctionDescriptionInvocation
useDebounceEffectDebounced useEffectAUTO
useDebounceFnDebounced function with run, cancel, flush controlsAUTO
useDeepCompareEffectuseEffect with deep dependency comparisonAUTO
useDeepCompareLayoutEffectuseLayoutEffect with deep dependency comparisonAUTO
useEffectEventPonyfill for React 19's useEffectEventAUTO
useEffectWithTargetuseEffect that supports target DOM element(s) as dependenciesAUTO
useIntervalInterval timer with auto-cleanupAUTO
useIsHydratedReturns true after client hydration completesAUTO
useIsomorphicLayoutEffectuseLayoutEffect on client, useEffect on serverAUTO
useMountRuns a callback only on component mountAUTO
useThrottleEffectThrottled useEffectAUTO
useThrottleFnThrottled function with run, cancel, flush controlsAUTO
useTimeoutTimeout timer with auto-cleanupAUTO
useUnmountRuns cleanup on component unmountAUTO
useUpdateReturns a function that forces component re-renderAUTO
useUpdateEffectuseEffect that skips the first renderAUTO

Browser

FunctionDescriptionInvocation
useActiveElementTrack the currently focused elementAUTO
useBatteryReactive battery level and charging informationAUTO
useClickAnyWhereListen to click events anywhere on the documentAUTO
useClickAwayDetect clicks outside of target element(s)AUTO
useClipboardReactive Clipboard API with read/write supportAUTO
useDocumentVisibilityReactive document visibility stateAUTO
useElementSizeReactive element size via ResizeObserverAUTO
useEventListenerDeclarative event listener with auto-cleanupAUTO
useFpsReactive FPS (frames per second) measurementAUTO
useFullscreenReactive Fullscreen APIAUTO
useHashReactive window.location.hashAUTO
useHoverReactive hover state of an elementAUTO
useInViewportTrack element visibility via IntersectionObserverAUTO
useIsMatchMediaReactive CSS media query matchingAUTO
useIsOnlineReactive online/offline network statusAUTO
useMouseReactive pointer coordinates for mouse/touchAUTO
useNetworkReactive network connection informationAUTO
useOsReactive browser operating system detectionAUTO
useScrollLockLock/unlock scroll on a target elementAUTO
useTextSelectionReactive text selection state with bounding rectAUTO
useTitleReactive document title managementAUTO

Dev

FunctionDescriptionInvocation
useWhyDidYouUpdateLogs which props changed between renders (debug only)AUTO

External

FunctionDescriptionInvocation
useMcpModel Context Protocol client hook from use-mcpEXTERNAL
useQueryData fetching hook from @tanstack/react-queryEXTERNAL
useStickToBottomScroll-stick behavior from use-stick-to-bottomEXTERNAL
useSWRData fetching hook from swrEXTERNAL

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

add-hook

No summary provided by upstream source.

Repository SourceNeeds Review
General

test_skill

import json import tkinter as tk from tkinter import messagebox, simpledialog

Archived SourceRecently Updated
General

错敏信息检测

1. 安装https://clawhub.ai/xxxx/sensitive-check-skill 这个技能 2. 调用错敏信息检测技能,传入参数 userKey=xxxx,content=xxxx

Archived SourceRecently Updated
General

neo

Browse websites, read web pages, interact with web apps, call website APIs, and automate web tasks. Use Neo when: user asks to check a website, read a web page, post on social media (Twitter/X), interact with any web app, look up information on a specific site, scrape data from websites, automate browser tasks, or when you need to call any website's API. Keywords: website, web page, browse, URL, http, API, twitter, tweet, post, scrape, web app, open site, check site, read page, social media, online service.

Archived SourceRecently Updated