如果芯片占用了 80% 的空间,我该如何包装输入

问题描述 投票:0回答:1

我在带有材质 UI 的输入中使用 Chips,当 chips 占据大部分空间(例如 80%)时,我需要将输入包裹起来,并且 chips 位于顶部并包裹!

<MDInput
                  value={inputValue}
                  error={!!errors.tags}
                  onChange={(event) => setInputValue(event.target.value)}
                  onKeyDown={handleKeyDown}
                  onBlur={handleBlurChanges}
                  label="Press enter to add tag"
                  name="tags"
                  helperText={errors?.tags}
                  InputProps={{
                    startAdornment: (
                      <InputAdornment
                        sx={{
                          minHeight: "40px",
                        }}
                        spacing={1}
                        position="start"
                      >
                        {chips.map((chip, index) => (
                          <Chip
                            sx={{
                              marginRight: "5px",
                            }}
                            key={index}
                            label={chip}
                            onDelete={handleDelete(chip)}
                            variant="outlined"
                            onBlur={handleBlurChanges}
                          />
                        ))}
                      </InputAdornment>
                    ),
                  }}
                />
reactjs material-ui grid chips
1个回答
0
投票

你可以把

marginRight:5px
换成
marginLeft: 10px

© www.soinside.com 2019 - 2024. All rights reserved.