<PostSelector />

Lets you select one or multiple posts, and returns the selected post object.

link Example

import { PostSelector } from '@t2/editor';

<PostSelector 
	allowMultiple
	onSelect={selectedPosts => setAttributes({ posts: selectedPosts })}
/>

link Available props

Prop Type Description
postType? string; The posttype to pick from.
selectedPostTypes? string[]; Selected posttypes to pick from.
allowMultiple? boolean; Whether to allow multiple posts to be selected.
onSelect onSelect: (args1: WordPressSearchPost | WordPressSearchPost[]) => void; An onSelect function giving you access to the selected post object, or an array of posts
onRequestClose? () => void; A function to call when the modal closes
disabledIds? number[]; An array of post IDs that should be disabled.
selectedPosts? WordPressSearchPost[]; An array of selected posts.