--- title: useValue description: "`useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-value - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usevalue--basic --- ```tsx const breakpoint = useBreakpoint() const color = useValue({ base: "red", md: "green" }) return The current breakpoint is "{breakpoint}" ``` ```tsx const { colorMode } = useColorMode() const color = useValue(["green", "red"]) return The current colorMode is "{colorMode}" ``` ## Usage ```tsx import { useValue } from "@yamada-ui/react" ``` ```tsx import { useValue } from "@/components/ui" ``` ```tsx import { useValue } from "@workspaces/ui" ``` ```tsx const color = useValue({ base: "red", md: "green" }) ``` :::note `useValue` is using [useBreakpointValue](https://yamada-ui.com/hooks/use-breakpoint-value.md) and [useColorModeValue](https://yamada-ui.com/hooks/use-color-mode-value.md). :::