mui / mui/material-ui

[`@mui/material/styles`] `responsiveFontSizes` utility to extract values

Open
#30,537 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope: all components type: expected behavior
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

I'm using responsiveFontSizes(theme).
I have a component composed of a Typography and an Icon.
The problem is that when I use big variants, for instance h3, I get a really small icon in comparison:
image

I would like to be able to dynamically apply the same font-size to the icon as the responsive one given to the Typography component.

Examples 🌈

I was imagining an util function like this:
getResponsiveFontSize(variant)

<Icon fontSize={getResponsiveFontSize("h3")} />

getResponsiveFontSize(theme, variant) is maybe more realistic.

Motivation 🔦

The goal is to keep consistency between theme and css.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the responsiveFontSizes utility and the Typography and Icon APIs to understand how responsive variant sizes are calculated and exposed. Define how a getResponsiveFontSize-style API should accept the theme and variant, then verify that an icon can receive the same responsive font-size as the selected Typography variant.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.