Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextField] Add sizeMedium & variants support #26468

Merged
merged 1 commit into from
May 27, 2021

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented May 27, 2021

closes #26459

  • add variants to InputBase components.d.ts
  • add sizeMedium to inputBaseClasses

Question
I see that there are some components that missed classes like

  • InputLabel has only sizeSmall
  • FormLabel has only colorSecondary

Should we fix these in v5 before or in beta?

@siriwatknp siriwatknp requested a review from mnajdova May 27, 2021 05:17
@siriwatknp siriwatknp added the component: text field This is the name of the generic UI component, not the React module! label May 27, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented May 27, 2021

Details of bundle changes (experimental)

Generated by 🚫 dangerJS against c773706

@mnajdova
Copy link
Member

mnajdova commented May 27, 2021

I see that there are some components that missed classes like

  • InputLabel has only sizeSmall
  • FormLabel has only colorSecondary

Should we fix these in v5 before or in beta?

Let's hold off, at least till beta, this one is obvious as somebody experienced some pain for the use-case.

@oliviertassinari oliviertassinari changed the title [InputBase] add sizeMedium & variants [TextField] Add sizeMedium & variants support May 27, 2021
@siriwatknp siriwatknp merged commit 8cc7dd0 into mui:next May 27, 2021
@siriwatknp siriwatknp deleted the fix/input-base-type branch May 27, 2021 10:00
@@ -17,6 +17,8 @@ export interface InputBaseClasses {
error: string;
/** Styles applied to the input element if `size="small"`. */
sizeSmall: string;
/** Styles applied to the input element if `size="medium"`. */
sizeMedium: string;
Copy link
Member

@oliviertassinari oliviertassinari May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeMedium and inputSizeMedium are never applied on the DOM. https://github.com/mui-org/material-ui/blob/8cc7dd0568adde2b8c23804fabdadbd7cfff21d6/packages/material-ui/src/InputBase/InputBase.js#L28

In #25969 I was showcasing the problem with adding too many classes on the DOM nodes. I would personally advocate removing all the default class names / styleOverrides, to match Bootstrap: https://getbootstrap.com/docs/5.0/components/buttons/#sizes, forcing to customize the default class name first as a healthy constraint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, in my opinion, we should add those classes. Again I think we are coming back to this too many times :) On the PR that you linked, margin: none does not provide any styles, and it probably should never provide, but with the sizing props is different, especially if developers change the default props. If the default size for the component is changed to be small, there is no way of how the component can be customized in case size="medium"

Copy link
Member

@oliviertassinari oliviertassinari May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially if developers change the default props.

I would advocate that they shouldn't, that we shouldn't make it easier for them. I personally fail to see the use cases for size: small as a default. Instead, they could/should customize all the values to shift the size, making size: normal looks smaller.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I probably have hard time making a call of when this is ok and when not. Should we make it consistent for all props in that case? What I am trying to understand is, is this one-time thing, or should we follow this thinking everywhere. For example, if in a component, the primary is the default color, should we provide a class for it? I think it would be best if we have a rule that applies everwhere, thank having this discussion on each change we do :) (it's my fault 100%, but I am trying to make us more productive :D)

Copy link
Member

@oliviertassinari oliviertassinari May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the color, I would come back to what I was saying around following Bootstrap. Being primary by default seems subjective, it makes sense to have a class name/style override.

I think that we can come up with a RFC during the beta phase for this. To resolve this once for all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, and following Bootstrap as a base seems like a great start.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we should remove all "medium" size if it means "default". will revert the change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related issue about default. #13028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[InputBase] "variants" & "sizeMedium" type does not exist
4 participants