Skip to main content
Version: Current (v7.0.0-beta.3)

Custom daisyUI buttons that render their own button add the btn class

Detect​

  • A custom AddButton, RemoveButton, CopyButton, MoveUpButton or MoveDownButton in your templates for @rjsf/daisyui that renders its own <button> with the className it 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 btn class and looks like the theme's own buttons.

Also read: