Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Shared
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Hooks
Resources
useMobile
Boolean viewport check for mobile layouts.
A lightweight React hook that returns true when the viewport is below the mobile breakpoint (768px). Listens to media-query changes so layouts swap live on resize.
Installation
pnpm dlx shadcn@latest add @frontal-labs/use-mobile
Usage
import { useIsMobile } from "@/hooks/use-mobile";
function Layout() {
const isMobile = useIsMobile();
return isMobile ? <MobileNav /> : <DesktopNav />;
}Returns false on first server render, then corrects after mount — gate mobile-only effects behind it if hydration mismatch matters.
For breakpoint names, ranges, or pointer queries, use useMediaQuery instead. useMediaQuery("max-md") is the equivalent expressive form.
API
function useIsMobile(): boolean;Return value
boolean — true when window.innerWidth < 768.
On This Page