Skip to main content
Version: 2.xx.xx

File

This field is used to display files and uses <Typography.Link> from Ant Design.

Usage

Let's see how we can use <FileField> with the example in the edit page.

import { 
List,
Table,
FileField
} from "@pankod/refine";

export const PostList: React.FC = () => {
return (
<List>
<Table<IPost> rowKey="id">
<Table.Column
dataIndex="title"
title="Title"
/>
<Table.Column<IPost>
title="Image"
dataIndex="image"
render={(_, record) => (
<FileField src={record.image[0].url} />
)}
/>
</Table>
</List>
);
};

interface IPost {
id: string;
title: string;
image: [
{
url: string;
},
];
}
tip

If you don't use title prop it will use src as title


FileField

API Reference

Properties

PropertyDescriptionTypeDefault
src
Required
Used for file pathstring
titleUsed for file titlestring | undefinedThe src property
LinkPropsAnt Design <Typography> propertiesLinkProps