Skip to content

Commit

Permalink
Documentation: document block style variations (#9155)
Browse files Browse the repository at this point in the history
* Documentation: document block style variations

* docs: tweak grammar
  • Loading branch information
youknowriad authored Aug 20, 2018
1 parent e8f6bb0 commit 2ff0a29
Showing 1 changed file with 17 additions and 1 deletion.
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

0 comments on commit 2ff0a29

Please sign in to comment.