Custom daisyUI buttons that render their own button add the btn class
Detect
- A custom
AddButton,RemoveButton,CopyButton,MoveUpButtonorMoveDownButtonin yourtemplatesfor@rjsf/daisyuithat renders its own<button>with theclassNameit receives. - On the rendered page, that button has lost its daisyUI button styling.
Change
The theme's add, remove, copy and move buttons are now core's IconButton (see The daisyUI theme renders core's templates and widgets with its classes). Their btn btn-sm classes come from the class map's iconButton, which core's IconButton reads, rather than from the className the theme hands the button templates. Add btn yourself, or read the class from registry.classMap.iconButton:
+import { joinClassNames } from '@rjsf/utils';
+
function MyRemoveButton({ className, registry, ...props }) {
- return <button type='button' className={className} {...props} />;
+ return <button type='button' className={joinClassNames(registry.classMap.iconButton, className)} {...props} />;
}
Verify
- Your custom button renders with the
btnclass and looks like the theme's own buttons.
Also read: