UNPKG

@wordpress/block-library

Version:
87 lines (62 loc) 4.42 kB
# Playlist <!-- START TOKEN(Autogenerated block API docs) --> <div class="callout callout-warning">This block is <strong>experimental</strong> and may change or be removed without notice.</div> Embed a simple playlist. - **Name:** `core/playlist` - **Category:** [media](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/) - **API Version:** [3](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/) - **Block Type:** [Hybrid](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/) (static save + server enhancements) - **Keywords:** `music`, `sound` ## Block Relationships **[Allowed](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#allowed-blocks) inner blocks:** - [`core/playlist-track`](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/core-block-playlist-track/) ## Attributes _Defined via the [`attributes`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/) property in block.json._ | Attribute | [Type](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#type-validation) | [Default](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#default-value) | Description | |-----------|------|---------|-------------| | `currentTrack` | `string` | — | — | | `type` | `string` | `"audio"` | — | | `order` | `string` | `"asc"` | — | | `showTracklist` | `boolean` | `true` | — | | `showImages` | `boolean` | `true` | — | | `showArtists` | `boolean` | `true` | — | | `showNumbers` | `boolean` | `true` | — | | `showTrackLength` | `boolean` | `true` | — | | `caption` | `string` | — | — | ## Supports _Defined via the [`supports`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) property in block.json._ - [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true` - [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `true` - [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color): - [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true` - [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true` - [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity): `true` - [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing): - `margin`: `true` - `padding`: `true` ## Context _Defined via the [`usesContext` and `providesContext`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-context/) properties in block.json._ **Provides context:** - `showArtists` → attribute `showArtists` - `currentTrack` → attribute `currentTrack` ## Block Styles _Defined via the [`styles`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/) property in block.json._ | Style Name | Label | Default | |------------|-------|---------| | `bars` | Bars | Yes | | `mirror` | Mirror | No | | `line` | Line | No | | `blocks` | Blocks | No | | `dots` | Dots | No | | `seekbar` | Seekbar | No | ## Block Markup This is a [**hybrid block**](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/). It saves static markup that the server may enhance during rendering. ```html <!-- wp:playlist {"type":"audio","order":"asc","showTracklist":true,"showImages":true,"showArtists":true,"showNumbers":true,"showTrackLength":true} --> <!-- Content... --> <!-- /wp:playlist --> ``` ## Source - [block.json](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/playlist/block.json) ([reference](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/)) - [Source directory](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/playlist/) — browse `edit.js`, `save.js`, `index.php`, and more. <!-- END TOKEN(Autogenerated block API docs) -->