Leave Yamada UI a star

Star
Yamada UIYamada UIv1.5.0

useColorModeValue

useColorModeValue is a custom hook that returns the value of the current color mode from the provided values.

Source@yamada-ui/core

Import

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

Usage

Editable example

const { colorMode } = useColorMode()
const bg = useColorModeValue("blackAlpha.800", "whiteAlpha.800")
const color = useColorModeValue("whiteAlpha.800", "blackAlpha.800")

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

Edit this page on GitHub

PrevioususeColorModeNextuseDisclosure