Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

useBreakpoint

useBreakpoint is a custom hook that returns the current breakpoint. This hook monitors changes in the window size and returns the appropriate value.

Source@yamada-ui/use-breakpoint

Import

import { useBreakpoint } from "@yamada-ui/react"
Copied!

Usage

Editable example

const breakpoint = useBreakpoint()

return (
  <Box
    bg={{
      base: "red.500",
      xl: "blue.500",
      lg: "green.500",
      md: "yellow.500",
      sm: "purple.500",
    }}
    p="md"
    rounded="md"
    color="white"
    transitionProperty="all"
    transitionDuration="slower"
  >
    The current breakpoint is "{breakpoint}"
  </Box>
)
Copied!

Edit this page on GitHub

PrevioususeBooleanNextuseBreakpointEffect