Skip to main content
useBreakpoints
@coinbase/cds-web@8.13.6
Returns an object with a boolean for each breakpoint of the window. Useful for conditionally rendering components or component trees based on the current window breakpoint.
Import
import { useBreakpoints } from '@coinbase/cds-web/hooks/useBreakpoints'
SourceView source code
Related components

Basic usage

Use the useBreakpoints hook to conditionally render components or component trees based on the current window breakpoint.

See how breakpoints are defined in the media object →

Warning

Do not use useBreakpoints for responsive styles. Use CSS media queries or the StyleProps API for responsive styles.

Loading...
Live Code
() => {
  const breakpoints = useBreakpoints();
  return <JSONCodeBlock json={breakpoints} />;
};

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.