gokcan / react-shimmer

🌠 Async loading, performant Image component for React.js
https://nh9x1.csb.app
MIT License
1.16k stars 36 forks source link

How to apply custom css classes to <img>? #123

Closed fachryansyah closed 1 year ago

fachryansyah commented 1 year ago

I want to add custom css into <img, there's no props to handle that

Edit-- I'm already tried add css into className props didn't work

<Image
   src={item.image}
  width={512}
  height={512}
  alt="Berita1"
  className="rounded-xl"
   fadeIn={true}
   delay={2}
  fallback={<Shimmer width={512} height={512} />}
/>
Screen Shot 2023-04-05 at 14 37 27
gokcan commented 1 year ago

You may use NativeImgProps. Also, alt should be used with NativeImgProps.

Reference: https://github.com/gokcan/react-shimmer#properties

Example:


<Image
  src={item.image}
  width={512}
  height={512}
  fadeIn={true}
  delay={2}
  fallback={<Shimmer width={512} height={512} />}
  NativeImgProps={{ alt="Berita1", className: "rounded-xl" }}
/>
gokcan commented 1 year ago

Also, see: https://github.com/gokcan/react-shimmer/issues/71