<PostSelector />
Lets you select one or multiple posts, and returns the selected post object.
Example
import { PostSelector } from '@t2/editor';
<PostSelector
allowMultiple
onSelect={selectedPosts => setAttributes({ posts: selectedPosts })}
/>
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. |
Multisite
Read more about multisite support in the Multisite documentation.