react-grid-gallery
react-grid-gallery copied to clipboard
Can I add a link in the caption?
Hi, can I add a link in caption so I can redirect to a new web page by clicking the link? Thanks
Hi @jefflung!
You can pass anything that React can render via caption
prop, any jsx included.
const image1 = {
src: "https://upload.wikimedia.org/wikipedia/commons/e/ee/Apples.jpg",
thumbnail: "https://upload.wikimedia.org/wikipedia/commons/e/ee/Apples.jpg",
thumbnailWidth: 320,
thumbnailHeight: 480,
caption: (
<a
href="https://en.wikipedia.org/wiki/Apple"
target="_blank"
rel="noreferrer"
>
Apple
</a>
)
};
function App() {
return <Gallery images={[image1]} />;
}
Here is a sandbox to play with.
Sorry for the late response and have an awesome day!