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

ll-feishu-audio

飞书语音交互技能。支持语音消息自动识别、AI 处理、语音回复全流程。需要配置 FEISHU_APP_ID 和 FEISHU_APP_SECRET 环境变量。使用 faster-whisper 进行语音识别,Edge TTS 进行语音合成,自动转换 OPUS 格式并通过飞书发送。适用于飞书平台的语音对话场景。

Archived SourceRecently Updated
General

test_skill

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

Archived SourceRecently Updated
General

51mee-resume-profile

简历画像。触发场景:用户要求生成候选人画像;用户想了解候选人的多维度标签和能力评估。

Archived SourceRecently Updated
shadcn-hooks | V50.AI