Is it possible to add an image to a cell Table in Ant Design Tables?

I am trying to create a column that in his entries will include a small picture and a name. How can I do so using Ant Design's table? I can't seem to find anything related in the docs or the examples.



If you were using the table in a similar way as to the examples shown in their docs.(Using a datasource array)

You could do something like this

const columns = [
    title: '',
    dataIndex: 'image_URL_here',
    render:  () => <img src={`image_URL_here`} />

There is a mistake in the accepted answer , here how you do it

      title: "Image",
      dataIndex: "ImageURL",  // this is the value that is parsed from the DB / server side
      render: theImageURL => <img alt={theImageURL} src={theImageURL} />  // 'theImageURL' is the variable you must declare in order the render the URL

You need to declare theImageURL and then use it with the alt and src.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.