-
Notifications
You must be signed in to change notification settings - Fork 832
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
How to change the styling? #393
Comments
Check appropriate documentation section. For text field styling use ‘classes’ property as for default material hi TextField component. |
@dmtrKovalenko I've tried these:
and
|
I have the same problem now. Any luck @nickisaacs ? |
@lmahapatra-oliver-it
|
If any of you are still interested on this:
|
i solved it via the InputProps key, took me a while till i found this part of the doc, saying:
so i can override any style of the component like this:
where |
There is no solution as of yet. However there is a workaround to pass a css class name to popup/dialog container. Pass an img tag for rightArrowIcon props of datepicker with onload function to call its parent and inject css class.
|
For arrow icons you can pass css right to |
@Wgil thx I could die in peace now thx. Why InputProps isn't mentioned inside API documentation ? Cloud be good to add that |
I've been able to do this a little differently, I leaned into the inspector to get class names, etc :
|
I cannot see MuiPickersDay as a override in createMuiTheme |
@tkatariya See #1794. |
If you want to control the input, follow the standard input guidelines here "Customized Inputs": Then in your theme provider / creator use this:
Obviously you have to have the correct imports, and you need to feed this into the theme provider. |
I needed to change the visibility of a day in DatePicker, so I used the renderDay prop of DatePicker:
|
To change the dialog styling you can do this...
|
It seems the difficult part is finding the exact Mui component to override. You really need to find the exact Mui component that is generating the color, and then override that specific component. In my case I had a signup form (similar to this: https://github.com/mui-org/material-ui/blob/master/docs/src/pages/getting-started/templates/sign-up/SignUp.js) where all the component text and borders were showing as black against a very dark background when not selected. After some trial and error I was able to change all the colors in the form with this:
|
I ended up using I'll leave mine here FWIW. import {
MuiPickersUtilsProvider,
DatePicker,
} from '@material-ui/pickers'
import DateFnsUtils from '@date-io/date-fns'
import { useDripsyTheme } from 'dripsy'
export default function Picker(props) {
const {
colors,
fonts,
radii,
borderWidths,
fontSizes,
space,
} = useDripsyTheme().theme
return (
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<DatePicker
{...props}
inputProps={{
style: {
color: colors.text,
borderColor: colors.muted5,
fontFamily: fonts.root,
borderStyle: 'solid',
borderWidth: borderWidths[1],
borderRadius: radii[3],
outline: 'none',
fontSize: fontSizes[3],
padding: `${space[2]}px`,
},
}}
/>
</MuiPickersUtilsProvider>
)
} |
@nandorojo Mind that in v4, we have changed the API to be declarative, following the model of the Autocomplete, see https://next.material-ui-pickers.dev/demo/datepicker. |
Environment
How to change the styling of input and DatePicker dialog?
I want to change the following styles:
The text was updated successfully, but these errors were encountered: