typography variant in the Material UI

Viewed 381

I am a new material UI, I am trying to use Typography, if I don't use variant in the typography tag, it is fine

<div className="login-details">
  <Typography>{details ? details.email : "N/A"} |</Typography>

  <Button type="link" onClick={()=> document.dispatchEvent(new CustomEvent("user.start_logout"))}>
              logout
            </Button>
</div>

without variant

if I use a variant like below, the UI is falling apart

<div className="login-details">
        <Typography variant="h2">{details ? details.email : "N/A"} |</Typography>

        <Button type="link" onClick={() => document.dispatchEvent(new CustomEvent("user.start_logout"))}>
          logout
        </Button>
      </div>

With variant

Please help me. Thanks in Advance.

1 Answers

Not using a variant is equivalent to variant="body1". Check your h2 style, particularly the line height and margins. Refer to the documentation on how to customise the default typography.

Related