--- 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 --- # useValue `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. ```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). ::: ## Uses Components & Hooks - [useBreakpoint](https://yamada-ui.com/docs/hooks/use-breakpoint.md): `useBreakpoint` is a custom hook that returns the current breakpoint. This hook monitors changes in the window size and returns the appropriate value. ## Used By Components & Hooks - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions. - [AlphaSlider](https://yamada-ui.com/docs/components/alpha-slider.md): `AlphaSlider` is a component used to allow the user to select color transparency. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together. - [HueSlider](https://yamada-ui.com/docs/components/hue-slider.md): `HueSlider` is a component used to allow the user to select a color hue. - [InfiniteScrollArea](https://yamada-ui.com/docs/components/infinite-scroll-area.md): `InfiniteScrollArea` is a component that provides infinite scrolling functionality. This component offers a smooth scrolling experience by automatically loading and displaying the next dataset when the end of the component is reached. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Reorder](https://yamada-ui.com/docs/components/reorder.md): `Reorder` is a component that allows you to change the order of items using drag and drop. - [Resizable](https://yamada-ui.com/docs/components/resizable.md): `Resizable` is accessible resizable panel groups and layouts with keyboard support. - [SegmentedControl](https://yamada-ui.com/docs/components/segmented-control.md): `SegmentedControl` is a component used for allowing users to select one option from multiple choices. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [Slider](https://yamada-ui.com/docs/components/slider.md): `Slider` is a component used for allowing users to select a value from a range. - [Steps](https://yamada-ui.com/docs/components/steps.md): `Steps` is a component that displays the progress of a multi-step process. - [Tabs](https://yamada-ui.com/docs/components/tabs.md): `Tabs` is a component for switching between different display areas. - [Timeline](https://yamada-ui.com/docs/components/timeline.md): `Timeline` is a component that is used to display a list of events in chronological order.