Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: document block style variations #9155

Merged
merged 2 commits into from
Aug 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/extensibility/extending-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@

## Modifying Blocks

To modify the behavior of existing blocks, Gutenberg exposes the following Filters:
To modify the behavior of existing blocks, Gutenberg exposes several APIs:

### Block Style Variations

Block Style Variations allow providing alternative styles to existing blocks. They work by adding a className to the block's wrapper. This className can be used to provide an alternative styling for the block if the style variation is selected.

_Example:_

```js
wp.blocks.registerBlockStyle( 'core/quote', 'fancy-quote' );
```

The example above registers a block style variation called `fancy-quote` to the `core/quote` block. When the user selects this block style variation from the styles selector, an `is-style-fancy-quote` className will be added to the block's wrapper.

### Filters

Extensing blocks can involve more than just providing alternative styles, in this case, you can use one of the following filters to extend the block settings.

#### `blocks.registerBlockType`

Expand Down