Changeset 11157 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/page-dashicons.php
- Timestamp:
- 07/28/2021 07:44:34 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/page-dashicons.php
r10186 r11157 536 536 </pre> 537 537 538 <h3><?php _e( 'Block Usage', 'wporg' ); ?></h3> 539 540 <p><?php _e( 'The block editor supports use of dashicons as block icons and as its own component.', 'wporg' ); ?></p> 541 542 <h4><?php _e( 'Examples', 'wporg' ); ?></h4> 543 544 <p><?php printf( 545 /* translators: %s: URL to Block Editor Handbook for registering a block. */ 546 __( 'Adding an icon to a block. The <code>registerBlockType</code> function accepts a parameter "icon" which accepts the name of a dashicon. The provided example is truncated. See the <a href="%s">full example</a> in the Block Editor Handbook.', 'wporg' ), 547 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/writing-your-first-block-type/#registering-the-block' 548 ); ?></p> 549 550 <pre> 551 registerBlockType( 'gutenberg-examples/example-01-basic-esnext', { 552 apiVersion: 2, 553 title: 'Example: Basic (esnext)', 554 icon: 'universal-access-alt', 555 category: 'design', 556 example: {}, 557 edit() {}, 558 save() {}, 559 } ); 560 </pre> 561 <p><?php printf( 562 /* translators: %s: URL to handbook page for Dashicon component. */ 563 __( 'Using an icon as a component. A dedicated <code>Dashicon</code> component is available. See the <a href="%s">related documentation</a> in the Block Editor Handbook.', 'wporg' ), 564 'https://developer.wordpress.org/block-editor/reference-guides/components/dashicon/' 565 ); ?></p> 566 567 <pre> 568 import { Dashicon } from '@wordpress/components'; 569 570 const MyDashicon = () => ( 571 <div> 572 <Dashicon icon="admin-home" /> 573 <Dashicon icon="products" /> 574 <Dashicon icon="wordpress" /> 575 </div> 576 ); 577 </pre> 578 538 579 <h3><?php _e( 'Photoshop Usage', 'wporg' ); ?></h3> 539 580
Note: See TracChangeset
for help on using the changeset viewer.