useMediaQuery

CSS media query hooks, it is implemented through the MediaQuery API. If you just want to build the layout, try Grid Component.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Match Type

You can choose to match up or down.

custom breakpoints

Override the default breakpoints of the himalaya.

const breakpoints: UIThemesBreakpoints = {
  xs: { min: '0', max: '650px' },
  sm: { min: '650px', max: '900px' },
  md: { min: '900px', max: '1280px' },
  lg: { min: '1280px', max: '1920px' },
  xl: { min: '1920px', max: '10000px' },
}

const App = () => {
  const myTheme = Themes.createFromLight({
    type: 'myTheme',
    breakpoints,
  })
  return (
    <ConfigProvider themes={[myTheme]} themeType="myTheme">
      <CssBaseline />
      <AppComponent />
    </ConfigProvider>
  )
}

APIs

useMediaQuery

type ResponsiveBreakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'mobile'

type ResponsiveOptions = {
  match?: 'up' | 'down'
  ssrMatchMedia?: (query: string) => { matches: boolean }
}

const useMediaQuery = (breakpoint: ResponsiveBreakpoint, options?: ResponsiveOptions) =>
  boolean