Post Rendering
Custom Post Rendering
UIKit provides default renderers for the core data types: text, image, and file. It also provides a way to render your own UI for your custom post.
Post Structure
A single post UI is composed of 1 or more blocks. This allows reusability of block components such as header or footer which can be shared by different kinds of posts.

This is an example of an image post which contains three tableview cells. Top cell represents the header, middle cell contains content and bottom cell is footer cell.
Creating UI for custom posts
First, you need to create your custom renderer.
import { AmityPostContainer, AmityPostEngagementBar } from '@amityco/ui-kit';
function CustomPostRenderer({ className, post }) {
return (
<AmityPostContainer className={className}>
...
<AmityPostEngagementBar postId={post.postId} />
</AmityPostContainer>
);
}
Then, you need to pass your renderer into AmityUiKitProvider
function MyApp() {
return (
<AmityUiKitProvider
postRenderers={{
customPostDataType: (props) => <CustomPostRenderer {...props} />,
image: (props) => <CustomImagePostRenderer {...props} />,
}}
>
...
</AmityUiKitProvider>
);
}
Last updated
Was this helpful?