reactjsantd

Is there a way to change icons in the ant design image preview operations?


I'm using the Image component from ant design which also has a preview and in top right corner there are operations to zoom rotate etc for the image but I want to change these icons, I found there is an icons property for the preview config props but I can't figure out how the structure is because it is not given in the documentation.

<Image
        src={imageUrl}
        preview={{
          visible: state.visible,
          onVisibleChange: (visible) => closeModal(),
          destroyOnClose: true,
          icons: [] -- How do I add custom icons here?
        }}
      />

Solution

  • export const icons = {
      rotateLeft: <RotateLeftOutlined />,
      rotateRight: <RotateRightOutlined />,
      zoomIn: <ZoomInOutlined />,
      zoomOut: <ZoomOutOutlined />,
      close: <CloseOutlined />,
      left: <LeftOutlined />,
      right: <RightOutlined />,
    };
    

    default icons