Skip to content
aq-ui
Back to HooksHook

Use Breakpoint

Open-code aq-ui React hook for Use Breakpoint.

Installation

pnpm dlx aq-ui@alpha add use-breakpoint

API reference

Client module

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

"use client"

import { useBreakpoint } from "@/hooks/use-breakpoint"

Breakpoint

typeSource L13

Type contract for Breakpoint.

type Breakpoint = keyof typeof breakpoints

breakpoints

constSource L5

Public const export from Use Breakpoint.

const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280, "2xl": 1536, } as const

useBreakpoint

functionSource L20

Open-code aq-ui React hook for Use Breakpoint.

function useBreakpoint(breakpoint: Breakpoint | number, { direction = "up", defaultValue = false }: UseBreakpointOptions = {}): boolean
Returns
boolean

Parameters

NameTypeDefault
breakpointBreakpoint | number—
options?UseBreakpointOptions{}

UseBreakpointOptions

interfaceSource L15

Type contract for UseBreakpointOptions.

interface UseBreakpointOptions

Members

NameTypeDefault
direction?"up" | "down""up"
defaultValue?booleanfalse

Registry dependencies

use-media-query

Files

  • hooks/use-breakpoint.ts

Source