最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I change the size of material UI StaticTimePicker - Stack Overflow

programmeradmin2浏览0评论
import { StaticTimePicker } from '@mui/x-date-pickers/StaticTimePicker';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
      
  <LocalizationProvider dateAdapter={AdapterDayjs}>
          <DemoContainer components={['StaticTimePicker']}>
            <StaticTimePicker
              value={values.time}
              onChange={(newValue) =>
                handleChange({ target: { name: 'time', value: newValue } })
              }
              orientation="landscape"
              defaultValue={dayjs(formattedDateTime)}
            />
          </DemoContainer>
        </LocalizationProvider>

How to change the size of the StaticTimePicker?

I tried by adding sx prop and slotProps as well but it is not working.

import { StaticTimePicker } from '@mui/x-date-pickers/StaticTimePicker';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
      
  <LocalizationProvider dateAdapter={AdapterDayjs}>
          <DemoContainer components={['StaticTimePicker']}>
            <StaticTimePicker
              value={values.time}
              onChange={(newValue) =>
                handleChange({ target: { name: 'time', value: newValue } })
              }
              orientation="landscape"
              defaultValue={dayjs(formattedDateTime)}
            />
          </DemoContainer>
        </LocalizationProvider>

How to change the size of the StaticTimePicker?

I tried by adding sx prop and slotProps as well but it is not working.

Share Improve this question asked Mar 19 at 8:48 Manali ShahManali Shah 92 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

try this

<Box sx={{ width: "250px", height: "250px", "& .MuiClock-root": { transform: "scale(0.8)" } }}>
  <StaticTimePicker
    value={values.time}
    onChange={(newValue) =>
      handleChange({ target: { name: 'time', value: newValue } })
    }
    orientation="landscape"
    defaultValue={dayjs(formattedDateTime)}
  />
</Box>
发布评论

评论列表(0)

  1. 暂无评论