Skip to main content

Module - Core

The Mui.Core module contains a few manual bindings to potentially useful functions.

useTheme() => Mui.Theme.t

A react hook to get the current theme. See this page for more details.

useMediaQuery(Breakpoint.t) => bool

A react hook to execute a programmatic media query. It returns a boolean for wether the query is true or not.

The useMediaQuery uses a type of Mui.Core.Breakpoint.t. (See this page for more information).

You can construct a breakpoint like this:

@react.component
let make = () => {
open Mui.Core
let theme = useTheme()
let matches = useMediaQuery(Breakpoint.get(theme, #up(#sm)))
Js.log(matches)

<div />
}

useMediaQueryString(string) => bool

It serves the same purpose as the one mentioned above, but you can pass a string with a custom query instead of a breakpoint. (See this page for more information).