Make your AI a shadcn expert

React useScreen Hook

React useScreen hook for accessing window.screen properties. Device dimensions, color depth, orientation. SSR safe.

React useScreen Hook preview

Scroll to load preview

Access the full Screen API in React with useScreen. Returns the window.screen object with all device display properties that update on resize. Get physical screen dimensions, available workspace size, color depth, pixel depth, and screen orientation. Optional debounce delay for resize events. Returns undefined during SSR and optionally until client hydration. Provides stable screen object reference with all standard Screen interface properties. Perfect for responsive design decisions, device capability detection, orientation-aware layouts, or display quality checks. Works with Next.js App Router.

Install with AI

If you've connected the shadcn.io MCP server to Claude Code, Cursor, Windsurf, or any MCP-ready AI editor, prompt your agent to install this hook for you — no copy-paste, no CLI:

use shadcnio to install the use-screen hook into my project

FAQ

Was this page helpful?

Sign in to leave feedback.