Mantine's label, description and input wrapper options apply to more widgets
Detect
- In your
uiSchema,labelProps,descriptionProps,errorProps,withAsterisk,labelElement,size,inputWrapperOrder,inputContainerorwrapperPropsin theui:optionsof a@rjsf/mantinefield. - In your Mantine theme,
defaultPropsforInputWrapper,Input,Slider,Select,CheckboxGrouporRadioGroup. - CSS or Mantine styling for a
RangeWidgetorAltDateWidget.
Change
Labels of the checkbox and radio groups:
CheckboxesWidgetandRadioWidgetapplylabelPropsto their label, except anid, since the label's id has to match the group'saria-labelledby.CheckboxesWidgetused to ignorelabelPropsentirely.- As in Mantine's groups,
labelPropscomes fromui:optionsor the Mantine theme'sCheckboxGroup/RadioGroupdefaultProps, thenui:options.wrapperProps, then the theme'sInputWrapperdefaultProps, so a theme group default wins overui:options.wrapperProps.
RangeWidget and AltDateWidget now render inside Mantine's Input.Wrapper, so the InputWrapper options apply to them as to Mantine's inputs:
- An option in
wrapperProps, fromui:optionsor else the Mantine theme'sInputandInputWrapperdefaultProps, wins over the same option set top-level, fromui:optionsor else the theme. So a theme'swrapperPropsvalue beats a top-levelui:optionsone, and an option set toundefinedinwrapperPropsfalls back to the theme'sInputWrapperdefaultProps. inputWrapperOrderorders or leaves out the title, description and errors, andlabelProps,descriptionProps,errorProps,withAsterisk,labelElementandsizestyle them.- The slider and the date parts take that
sizetoo, unless the Mantine theme'sSliderorSelectdefaultPropsgive them one and the field sets none of its own. A field that sets bothsizeandwrapperProps.sizesizes its inputs bysizeand its wrapper bywrapperProps.size, as a Mantine input does. - The theme's
Inputstyling props (classNames,styles,className,style,variantand the like) reach the wrapper too, as they do an input's. - The title keeps the field's title id (
root__title) whateverlabelPropssays, and has nofor. When it is hidden or left out ofinputWrapperOrderit is renderedhidden, so the inputs keep their name. - On
AltDateWidget, the root element props from the theme'sInputandInputWrapperdefaultProps(className,style,mod, style props such asmt, and therootentry ofclassNames,stylesandattributes) stay on each date part's own wrapper and aren't applied again around them all. So do the theme'sInputwrapperPropsother than theInputWrapperoptions and the Styles API props (classNames,styles,attributes,variantand the like, less theirrootentry). Set them inui:options.wrapperPropsto style the field's wrapper. AltDateWidgetapplies aninputContaineraround each date part, resolved as for aSelect, where it used to apply it around them all. Only theinputContainerof aui:options.wrapperPropsreaches the parts, over the theme'sSelectwrapperProps, since the field's own wrapper applies the rest.- Set these options on
InputWrapperin the theme, not onSlider: Mantine'sSliderspreads its owndefaultPropson its root element. RangeWidgetno longer passes Mantine input props thatSliderdoesn't take (leftSection,withErrorStyles,loadingand the like) or theInputWrapperoptions fromui:optionson to the slider's root element, where they became unknown attributes.
Descriptions:
- Every widget that renders a description, except
CheckboxWidget, appliesdescriptionPropsfromui:options,ui:options.wrapperPropsor the Mantine theme'sdefaultProps, resolved as Mantine resolves them. Onlyui:options.wrapperProps.descriptionPropsused to reach it. - The description is always rendered in a
div, including under awrapperProps.descriptionProps, which used to turn it back into Mantine's default<p>.
Move any option you set on Slider for the wrapper to InputWrapper, and remove options you had set expecting them to be ignored.
Verify
- Fields with
labelPropsordescriptionProps, inui:optionsor the theme, look as you intend. RangeWidgetandAltDateWidgetfields take the theme'sInputWrapperandInputstyling.- The slider's root element carries no unknown attributes in the console or the DOM.
Also read: