Hooks
React hooks for viewport, input, hover, storage, clipboard, and floating-panel behaviour, exported from the package root.
Reactberry exports its hooks from the package root. They are client-only; call them from components marked "use client".
Import#
typescript
import { useHover, useClickOutside, useLocalStorage } from "@reactberry/system";
useSidebar and SidebarProvider are exported from @reactberry/system/providers.
Hook reference#
Interaction#
- useHover — hover state for one element.
- useClickOutside — call a handler on clicks or taps outside an element.
- useKeyboardShortcuts — Cmd/Ctrl shortcuts for composer-style screens.
- useEnterSubmit — submit a form with Enter from a textarea.
useHoverList()— returns{ hoveredIndex, getHoverProps(index) }; spreadgetHoverProps(i)onto each item.useKeypress(key, callback)— callscallbackwhenkey(for example"Escape") is pressed.
Text and input#
- useAutosizeTextArea — grow a textarea with its content.
- useAnimatedText — reveal text character by character, for streamed responses.
- useCopyToClipboard — copy text and show a temporary "copied" state.
Storage and environment#
- useLocalStorage — state backed by
localStorage. - useStandaloneMode — whether the app runs as an installed PWA.
useBreakpoint(bp)/useShowOnBreakpoint(bp)—truewhen the viewport is at or abovebp, or exactly atbp. RequiresBreakpointProviderabove the component. Breakpoints:_(belowxs),xs32rem,sm48rem,md64rem,lg80rem,xl96rem.useOverlay(isOpen = true)— returns{ mounted, isStandalone }for SSR-safe overlay mounting.useReducedMotion()—truewhen the user prefers reduced motion.useTouchDevice()—truewhen touch is the primary input.
Floating panels#
- useDraggableResizable — the move and resize engine behind DraggableResizableModal.