Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.33 KB

File metadata and controls

57 lines (42 loc) · 1.33 KB

@rescript-mui documentation

Naming

@rescript-mui/material provides all components in individual files. The file pattern is:

Mui.[COMPONENT_NAME].res

If you wish to use the Typography component for example, it would look like this:

<Mui.Typography>
  {"Some example text"->React.string}
</Mui.Typography>

The component names map one to one to the ones found in the Component API section of the MUI documentation.

Namespace

The material package uses the Mui namespace. To avoid name clashes, prefer qualified component names such as Mui.Typography over opening the whole namespace.

@react.component
let make = () =>
  <div>
    <Mui.Typography variant=H4 gutterBottom=true>
      {"Headline"->React.string}
    </Mui.Typography>
    <Mui.Typography>
      {"Some example text"->React.string}
    </Mui.Typography>
  </div>

Supporting modules

The Mui namespace also contains bindings and types used across components:

Styling

MUI components accept className, classes, and sx, depending on the component. The following pages show common styling approaches: