Yamada UIにスターをあげる

スター
Yamada UIYamada UIv1.5.1

useBreakpointValue

useBreakpointValueは、提供されたオブジェクトから現在のブレイクポイントの値を返すカスタムフックです。このフックは、ウィンドウのサイズの変更を監視し、適切な値を返します。

ソース@yamada-ui/use-breakpoint

インポート

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

使い方

編集可能な例

const breakpoint = useBreakpoint()
const bg = useBreakpointValue({
  base: "red.500",
  "2xl": "pink.500",
  xl: "blue.500",
  lg: "green.500",
  md: "yellow.500",
  sm: "purple.500",
})

return (
  <Box
    bg={bg}
    p="md"
    rounded="md"
    color="white"
    transitionProperty="all"
    transitionDuration="slower"
  >
    The current breakpoint is "{breakpoint}"
  </Box>
)
Copied!

GitHubでこのページを編集する

useBreakpointStateuseClipboard