#Breakpoint version of useMediaQuery

6 messages · Page 1 of 1 (latest)

runic vine
#

useBreakpoint('sm') will return true on screens sm and bigger. and false otherwise

#

or something of that sort

proper lynx
#

I've created a cutom hook that I use in some Mantine project : 😉

export const useCustomMediaQuery = (screenSize = 'sm') => {
  const theme = useMantineTheme();
  return useMediaQuery(`(max-width: ${theme.breakpoints[screenSize]})`);
};

With this you can pass any breakpoint from the mantine theme

runic vine
proper lynx
#

Yes it will return true when it's on small device thanks to max-width if you want the opposite behavior use min-width