MUI X
Contents
The Time Range Field let the user select a time range with the keyboard.
—
<LocalizationProvider dateAdapter={AdapterDayjs}> <Stack spacing={4}> <MultiInputTimeRangeField /> </Stack> </LocalizationProvider>
The component can be uncontrolled or controlled
Uncontrolled field
Controlled field
<LocalizationProvider dateAdapter={AdapterDayjs}> <Grid container spacing={4} width={550}> <GridItem label="Uncontrolled field"> <MultiInputTimeRangeField defaultValue={[dayjs('2022-04-07T15:30'), dayjs('2022-04-07T18:30')]} /> </GridItem> <GridItem label="Controlled field"> <MultiInputTimeRangeField value={value} onChange={(newValue) => setValue(newValue)} /> </GridItem> </Grid> </LocalizationProvider>