question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Replace variant with kind in the components where the variant is used for altering the DOM structure

See original GitHub issue

Summary 💡

This RFC is proposing solution to the problem that we faced in https://github.com/mui-org/material-ui/issues/21749 - supporting custom variants for the component. The problem is the following: we want to offer developers the possibility to add their own custom variant values so that they can style their components differently that the supported options we have by default. However in some of the components, the variant property is used not only for styling, but also for changing the internal DOM structure. The problem is that if developers define their own custom variant, like dashed the component will not render anything, or at least will behave unexpectedly because it depends on the variant prop to be some of the defined values. This is the list of the components where we faced this issue:

  • CircularProgress
  • Drawer
  • FormControl
  • FormHelperText
  • InputAdornment
  • InputLabel
  • LinearProgress
  • Menu
  • MenuList
  • MobileStepper
  • NativeSelect
  • Select
  • SwipeableDrawer
  • TableCell
  • Tabs
  • TextField

Solution

My proposal for solving this issue is the following. We would replace the variant prop in this component with a different property - kind. This property will behave exactly as the current variant prop. After this change is done, we can safely then use the variant property for purely styling purposes and expose it to the developers for defining their custom variants.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
mnajdovacommented, Jun 28, 2021

@mnajdova What’s left to be done on this issue for v5?

We still need for these component a different prop in order to allow developers to add custom variants. We cannot simply use the variant prop as it would break the component. Would suggest deferring to v6, or at least solve it with adding new prop after v5.1, by maybe adding a new property so that we don’t have breaking changes.

1reaction
eps1loncommented, Aug 19, 2020

Do you have any idea how long it took me to merge them? sweat_smile

Ideally we’d be able to extract specific variants with a compiler for bundle size reduction. So that people who only use variant X only get the code for variant X. That’s a topic for https://github.com/mui-org/material-ui/issues/16280 though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC Variants | SAP Help Portal
The bgRFC component stores the called RFC function, together with the corresponding data, in the SAP database under a unique transaction ID (TID)....
Read more >
Upgrading Ruby on Rails
Upgrading Ruby on RailsThis guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails....
Read more >
Changelog - Cypress Documentation
This change aligns Cypress' cookie rules with the browser cookie rules. ... Imports in component testing support files are no longer tree-shaken by...
Read more >
MathML Core - W3C
The mathvariant attribute, if present, must be an ASCII ... Also note these elements only change the font-size within the <mroot> index, ...
Read more >
RFC 6350: vCard Format Specification
Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found