useValue
useValue
is a custom hook that combines useBreakpointValue
and useColorModeValue
.
Import
import { useValue } from "@yamada-ui/react"
Usage
Editable example
const { colorMode } = useColorMode() const breakpoint = useBreakpoint() const bg = useValue({ base: "red.500", xl: "blue.500", lg: "green.500", md: "yellow.500", sm: "purple.500", }) const color = useValue(["whiteAlpha.800", "blackAlpha.800"]) return ( <Box bg={bg} p="md" rounded="md" color={color} transitionProperty="all" transitionDuration="slower" > The current breakpoint is "{breakpoint}", colorMode is "{colorMode}" </Box> )
useValue
is using useBreakpointValue and useColorModeValue.
Edit this page on GitHub