<FormField label={t("bulk-upload")} type="file" name="file" inputProps={{ "aria-label":…
- User
<FormField label={t("bulk-upload")} type="file" name="file" inputProps={{ "aria-label": t("bulk-upload"), }} value={values?.file} labelClass={"fontSize20"} isRequired onChange={(e) => { setFile([...e.target.files]); }} /> In this if i am passing type=file...I want to change the text of choose file and no file choosen import React from "react";
// Lirary components import { Field } from "formik"; import styled from "@emotion/styled"; import { FormControl, InputBase, InputLabel, Box, FormHelperText } from "@mui/material";
// Icons import { OverlayTooltip } from "components";
export const BootstrapInput = styled(InputBase)(({ theme, disabled }) => ({ "label + &": { marginTop: theme.spacing(3), }, "& .MuiInputBase-input": { borderRadius: 4, position: "relative", backgroundColor: disabled ? "#efefef4d" : "#fcfcfb", border: "1px solid #ced4da", fontSize: 16, // width: "auto", padding: "10px 12px", transition: theme?.transitions?.create(["border-color", "background-color", "box-shadow"]), marginRight: "0px !important", "& input:invalid": { borderColor: "red", borderWidth: 2, }, }, }));
const FormTextField = ({ md, label, name, type, value, isRequired = false, formGroupClass = "", inputClass = "", labelClass = "", helpTextClass = "", showHelpIcon = false, helpText = "", placeholder = "", fromHeight = "", showHelpText = true, onBlur = () => {}, ...props }) => { return ( {({ field, form }) => { const isInvalid = form.errors[name];
return ( <FormControl variant="standard" md={md} fullWidth sx={{ width: "100%", }} className={formGroupClass} > <InputLabel shrink sx={{ position: "static", whiteSpace: "initial", fontSize: "20px", color: "#000", }} className={`labelClass ${fromHeight}`} > {label} {isRequired && ( <Box component="span" sx={{ fontSize: "24px" }} className="colorRed"> * </Box> )} {showHelpIcon && <OverlayTooltip helpText={helpText} iconClass={"height20 marginLeft5"} />} </InputLabel> <Box sx={{ width: "100%!important", }} > <BootstrapInput {...field} inputProps={{ maxLength: props?.maxLength }} type={type} value={value} className={inputClass} required={isRequired} fullWidth placeholder={placeholder} onBlur={onBlur} onKeyDownCapture={() => form.setFieldError(name, "")} sx={{ width: "100%!important", "& input": { width: "100% !important", borderColor: isInvalid && showHelpText ? "#A80000 !important" : "theme?.palette?.primary?.main", }, }} {...props} /> {showHelpText && ( <FormHelperText sx={{ color: "#A80000", }} className={helpTextClass} > {form.errors[field.name]} </FormHelperText> )} </Box> </FormControl> ); }} </Field> - Assistant