> For the complete documentation index, see [llms.txt](https://benjaminzekavica.gitbook.io/gutenberg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://benjaminzekavica.gitbook.io/gutenberg/plugins/block-picker-preview.md).

# Block Picker Preview

![](/files/-M5NCwfFiF1gZBC4VAPG)

Seit der neuen Version von Gutenberg wurde der Gutenberg Block Picker öfters überarbeitet. Diesmal gibt es eine Block Preview, die man als Entwickler zusätzlich noch anpassen kann. Diese Funktion ist optional, allerdings empfohlen!&#x20;

Denn durch die Vorschau weiß der Redakteur direkt bescheid, was für ein Block derzeit ausgewählt wurde.&#x20;

Diese Funktion ist abhängig von deinen Attributen. Diese musst du einfach erneut innerhalb dem **example** Befehl auflisten und einen Vorschau Inhalt eingeben. Hier ein Beispiel:&#x20;

```jsx
import './style.scss';

// Import Components 
import attributes from './globals/attributes';
import edit from './globals/edit';

// WP Packages 
import { __ } from '@wordpress/i18n'; 
import { registerBlockType } from '@wordpress/blocks';

// // Add Repeater Field 
registerBlockType( 'prwp-blocks/iconpicker', {
	title: __('Icon Picker'), 
	description: 'Dies ist ein Iconpicker.',
	category: 'prwpblocks',
	icon: {
		background: '#f0dd00',
		foreground: '#222832',
		src: 'star-half',
	},
	keywords: [
		__( 'iconpicker' ),
		__( 'icon' ), 
		__( 'dashicon' )
	],
	supports: {
		html: false
	},
	attributes,
	example: {
		attributes: {
			choosedIcon: 'fas fa-check',
			iconAlign: 'center',
			iconColorHex: '#f0dd00', 
			iconFontSize: 50, 
			iconContentsToggle: true,
			iconContentHeadline: 'Hallo Welt',
			iconContentDesc: 'Lorem Ipsum dolor sit amet'
		}
	},
	edit, 
	save: ( props ) => {
		return null
	}
});
```

#### Hier zur Verdeutlichung!

```jsx
	example: {
		attributes: {
			choosedIcon: 'fas fa-check',
			iconAlign: 'center',
			iconColorHex: '#f0dd00', 
			iconFontSize: 50, 
			iconContentsToggle: true,
			iconContentHeadline: 'Hallo Welt',
			iconContentDesc: 'Lorem Ipsum dolor sit amet'
		}
	}
```

That's it! Easy und vor allem schnell erledigt. Allerdings sobald Ihr den Block auswählt, werden die Inhalte dann im Bearbeitungseditor nicht angezeigt. **Diese Inhalte sind ausschließlich für die Vorschau gedacht.**&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://benjaminzekavica.gitbook.io/gutenberg/plugins/block-picker-preview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
