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

[docs] Demonstrate TextField customization using theme style overrides #36805

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Apr 8, 2023

Closes #33387
Closes #33931

This PR is to demonstrate the customization of the TextField component using theme style overrides as raised in #33387. The developers will take a look at our documentation, which will show the correct way to do this. It is particularly useful to demonstrate it for the TextField component because it uses multiple sub-components within it (based on variant) and is not straightforward to override.

We showcase how to apply different styles to the default component and with the hover and focused states.

The colors may not look ideal in both light and dark modes. A better design can be suggested. cc @danilo-leal

Preview: https://deploy-preview-36805--material-ui.netlify.app/material-ui/react-text-field/#using-the-theme-style-overrides-api

@ZeeshanTamboli ZeeshanTamboli added docs Improvements or additions to the documentation component: text field This is the name of the generic UI component, not the React module! customization: theme Centered around the theming features labels Apr 8, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Demonstrate text field customization theme style overrides [docs] Demonstrate TextField customization using theme style overrides Apr 8, 2023
@mui-bot
Copy link

mui-bot commented Apr 8, 2023

Netlify deploy preview

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against a543176

Copy link
Contributor

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

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

Sweet, thanks for working on this, @ZeeshanTamboli! Before continuing with the design tweaks, can I ask for you to set up dark mode to work on this? We should have demos that work on both modes instead of fixating it to one through a hard-coded dark bg 😬

@ZeeshanTamboli
Copy link
Member Author

ZeeshanTamboli commented Apr 11, 2023

Before continuing with the design tweaks, can I ask for you to set up dark mode to work on this? We should have demos that work on both modes instead of fixating it to one through a hard-coded dark bg

@danilo-leal Done. The custom theme provider is inside our doc's theme provider, and due to the custom theme overriding the doc's one, the default Material UI text field styles were not getting applied appropriately on both modes. That's the reason I had hard-coded the background. But we can get the palette mode of our docs i.e the outer theme's mode and apply it in our custom theme. So, now, I used useTheme, to get the palette mode of our docs and removed hard-coded background.

@ZeeshanTamboli
Copy link
Member Author

@danilo-leal Can you review this further?

@ZeeshanTamboli
Copy link
Member Author

@danilo-leal I think you were about to review. Any updates on this?

@danilo-leal
Copy link
Contributor

@ZeeshanTamboli Hey, yeah! Thanks for optimizing it for dark mode 🤝 I'll put in some time to go over this PR this week so we can get it out on the next release⎯thanks for the heads up!

Copy link
Contributor

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

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

Looking great now! Thanks for the patience + effort 🤙

@ZeeshanTamboli ZeeshanTamboli merged commit c6052a9 into mui:master May 8, 2023
18 checks passed
@ZeeshanTamboli ZeeshanTamboli deleted the demonstrate-text-field-customization-theme-style-overrides branch May 8, 2023 06:23
binh1298 pushed a commit to binh1298/material-ui that referenced this pull request May 17, 2023
…des (mui#36805)

Co-authored-by: Danilo Leal <danilo@material-ui.com>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
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! customization: theme Centered around the theming features docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] Include examples of the theme customization with hover
3 participants