0.3.0 • Published 4 years ago

gutenberg-post-picker v0.3.0

Weekly downloads
1
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

PostPicker

A simple Post Picker Component build with the core gutenberg components. This component does not include any build files and does not bundle the WordPress components. Therefore this needs to be used in an environemt where the Dependency Extraction Webpack Plugin is used and the import { component } from '@wordpress/package'; is supported.

Usage

import { PostPicker } from 'gutenberg-post-picker';

function MyComponent( props ) {

    return (
        <PostPicker
            onPostSelect={ console.log }
            label={ "Please select a Post or Page:" }
            postTypes={ [ 'posts', 'pages' ] }
        />
    )
}

Props

NameTypeDefaultDescription
onPostSelectfunctionundefinedCallback function that gets called with the post object upon selection
labelstring''Renders a label for the Search Field.
placeholderstring''Renders placeholder text inside the Search Field.
postTypesarray[ 'posts', 'pages' ]Names of the post types that should get searched

The postTypes will get used like this:

wp.apiFetch( {
    path: `/wp/v2/${postType}?search=${searchTerm}`
} )
0.3.0

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.0

4 years ago