@rjsf/mui
Version:
Material UI 7 theme, fields and widgets for react-jsonschema-form
25 lines (24 loc) • 1.7 kB
TypeScript
import { InputProps as MuiInputProps } from '@mui/material/Input';
import { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
import { BaseInputTemplateProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
/** Properties available for the MUI `ui:options` of the BaseInputTemplate.
* Unlike RJSF templates, `slotProps` here maps directly to MUI's native `TextField` `slotProps`,
* enabling type-safe customization of the underlying MUI sub-components. */
export interface BaseInputTemplateMuiProps extends GenericObjectType {
/** Native MUI `TextField` slotProps for targeting specific sub-components. */
slotProps?: {
/** Props applied to the base native HTML `<input>` or `<textarea>` element. */
htmlInput?: React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
/** Props applied to the MUI `Input` element, useful for `endAdornment`/`startAdornment`. */
input?: MuiInputProps;
/** Props applied to the MUI `InputLabel` element. */
inputLabel?: MuiInputLabelProps;
};
}
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
* It can be customized/overridden for other themes or individual implementations as needed.
*
* @param props - The `WidgetProps` for this template
*/
export default function BaseInputTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: BaseInputTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;