A form built from theme generators passes the theme's class map
Detect
generateTemplates()andgenerateWidgets()from@rjsf/daisyuior@rjsf/shadcnpassed towithThemeor toFormin your code, withoutgenerateTheme().- On the rendered page, fields, errors and array items appear without the theme's classes.
Change
Both themes now render core's components and style them through a classMap (see The daisyUI theme renders core's templates and widgets with its classes and The shadcn theme renders core's templates with its classes). generateTheme() includes it. A form put together from the generators passes classMap: generateClassMap() to withTheme, or classMap={generateClassMap()} to the Form, or core's components render without the theme's classes:
-import { generateTemplates, generateWidgets } from '@rjsf/daisyui';
+import { generateClassMap, generateTemplates, generateWidgets } from '@rjsf/daisyui';
-const Form = withTheme({ templates: generateTemplates(), widgets: generateWidgets() });
+const Form = withTheme({ templates: generateTemplates(), widgets: generateWidgets(), classMap: generateClassMap() });
Under @rjsf/shadcn, import generateClassMap from @rjsf/shadcn the same way.
Verify
- Fields, descriptions, errors and array items render with the theme's classes, as they do under
generateTheme().
Also read: