UNPKG

@wordpress/block-library

Version:
89 lines (57 loc) 4.73 kB
# Social Icon block The Social Icon is a foundational block that displays various icons linking to different social profiles or sites. Each social service is registered as a variation of this block. ## Adding new social icons The core maintains certain standards for adding new social icons. To add a new variation to WordPress, it must be well-established and popular. To evaluate if a social service should be added, contributors will consider the following factors: * Is the service popular enough for core developers to have heard of it before? Is it "mainstream?" * How long has the service been online? * Does it have a Wikipedia article? * Is there a plugin adding social icons in the repository that includes the services in question and has a considerable number of active installations? * Is this social service frequently requested? ## Adding custom social icons Starting from WordPress 6.9, it's possible to add custom social icons to your site. See: * Pull Request that introduced custom social icons - [#70261](https://github.com/WordPress/gutenberg/pull/70261). * Developer Blog tutorial for custom social icons - [Registering custom social icons in WordPress 6.9](https://developer.wordpress.org/news/2025/08/registering-custom-social-icons-in-wordpress-6-9/). <!-- START TOKEN(Autogenerated block API docs) --> Display an icon linking to a social profile or site. - **Name:** `core/social-link` - **Category:** [widgets](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-widgets/) - **API Version:** [3](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/) - **Block Type:** [Dynamic](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/) (server-rendered) ## Block Relationships **[Parent](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#parent) blocks (direct):** - [`core/social-links`](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-widgets/core-block-social-links/) ## 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 | |-----------|------|---------|-------------| | `url` | `string` | — | [Role](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#role): `content` | | `service` | `string` | — | — | | `label` | `string` | — | [Role](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#role): `content` | | `rel` | `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` - [`reusable`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#reusable): `false` - [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false` - [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity): - `clientNavigation`: `true` ## Context _Defined via the [`usesContext` and `providesContext`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-context/) properties in block.json._ **Uses context:** - `openInNewTab` - `showLabels` - `iconColor` - `iconColorValue` - `iconBackgroundColor` - `iconBackgroundColorValue` ## Block Markup This is a [**dynamic block**](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/). It is rendered on the server and does not save HTML in post content. In post content, it is stored as a block comment: ```html <!-- wp:social-link {"service":"spotify","url":"https://example.com/"} /--> ``` ## Source - [block.json](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-link/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/social-link/) — browse `edit.js`, `save.js`, `index.php`, and more. <!-- END TOKEN(Autogenerated block API docs) -->