Code Monkey home page Code Monkey logo

Comments (14)

LukasTy avatar LukasTy commented on July 3, 2024 2

You can also consider using more specific classes if you want more control over colors:

toolbar: {
  sx: (theme) => ({
    backgroundColor: "#455d7a",
    color: theme.palette.info.main,
    [`& .${pickersToolbarTextClasses.root}`]: {
      color: theme.palette.info.main,
    },
    [`& .${pickersToolbarTextClasses.selected}`]: {
      color: theme.palette.info.light,
    },
  }),
}

from mui-x.

michelengelen avatar michelengelen commented on July 3, 2024 1

got it ... here is an updated DEMO

Is this what you were looking for?

from mui-x.

michelengelen avatar michelengelen commented on July 3, 2024

To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! โœจ

For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction

Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself!

Thanks for your understanding! ๐Ÿ™‡๐Ÿผ

from mui-x.

achoud444 avatar achoud444 commented on July 3, 2024

@michelengelen Thank you for your assistance. Here is the working example of what I did and what exactly I want.
https://codesandbox.io/p/sandbox/flamboyant-dubinsky-x3lvkn?file=%2Fsrc%2FDemo.tsx

from mui-x.

achoud444 avatar achoud444 commented on July 3, 2024

@michelengelen Exactly this is what I needed. Thank you very much for the help.
I have one more question like can I change the title to something else "Select date range" to something else?

from mui-x.

michelengelen avatar michelengelen commented on July 3, 2024

I don't think it is ... at the very least you would lose the ability to use translations ... @LukasTy is there a way to do this?

from mui-x.

LukasTy avatar LukasTy commented on July 3, 2024

@achoud444 Of course, all the labels are stored in the localization, which you can override.
For the picker toolbars, try specifying this on the LocalizationProvider:

localeText={{
  dateRangePickerToolbarTitle: "Root toolbar title",
}}

or on the Picker component if you want this change to apply to this specific Picker component:

localeText={{
  toolbarTitle: "Picker toolbar title",
}}

from mui-x.

achoud444 avatar achoud444 commented on July 3, 2024

Awesome!!! Thank you very much both of you.

from mui-x.

LukasTy avatar LukasTy commented on July 3, 2024

I'm glad we could resolve your problems. ๐Ÿ™Œ
I'm closing this issue as all the problems seem to have been resolved. ๐Ÿ‘Œ

P.S. Feel free to check the Translated components page and the linked translations interface for all available options.

from mui-x.

github-actions avatar github-actions commented on July 3, 2024

โš ๏ธ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@achoud444: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

from mui-x.

achoud444 avatar achoud444 commented on July 3, 2024

@LukasTy Right now the text is in Captial letters I want to make it in Small
What I can see ROOT TOOLBAR TITLE What I want Root toolbar title`

localeText={{
  dateRangePickerToolbarTitle: "Root toolbar title",
}}

from mui-x.

LukasTy avatar LukasTy commented on July 3, 2024

@achoud444 The uppercase style is coming from the Typography component.
If you need to override this, try adding the following style to the toolbar.sx:

[`> .${typographyClasses.root}`]: {
  textTransform: "unset",
},

from mui-x.

achoud444 avatar achoud444 commented on July 3, 2024

@LukasTy @michelengelen I have a question if you can answer please
Is it better to use the sx property in MUI for styling components, or should I write the CSS in a separate file and override the CSS?

from mui-x.

LukasTy avatar LukasTy commented on July 3, 2024

Is it better to use the sx property in MUI for styling components, or should I write the CSS in a separate file and override the CSS?

@achoud444 I'd say that this is almost a "religious" question. ๐Ÿ™ˆ
If you prefer regular CSS declaration methodsโ€”feel free to use them, just be aware that you are responsible for adjusting classes if they ever change on the components. ๐Ÿ˜‰
CSS-in-JS methods provide a more robust API and have the capability to purge unused properties (if you override the property, that is already set on a componentโ€”it might be omitted in the final bundle).
You can learn about the performance topic of CSS-in-JS here.
Be aware that if a component is already styled on our components, using sx will not impact the performance in a meaningful way, it's mostly a question for creating new components, where performance is better the closer we go to primitives.

P.S. MUI is working on Pigment CSS, which will mostly negate the performance problems, by extracting CSS at build time.

from mui-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.