JavaScript for WordPress Forums Gutenberg Development Dashicons in custom toolbar control button Reply To: Dashicons in custom toolbar control button

#53342
jbr
Participant

Not too much yet, I’d tried adding the icon name as an attribute to the button in the JSX, and trying to find a way to import from Dashicons.

Do you know if the icons are stored anywhere in WP in JSX format so they can be called in the same way as the SVG icons?

i.e. like



import icon from './icon';

.
.
.

 <Toolbar>
                            <Tooltip text={ __( 'High Contrast', 'jsforwpblocks' )  }>
                                <Button
                                    className={ classnames(
                                        'components-icon-button',
                                        'components-toolbar__control',
                                        { 'is-active': highContrast },
                                    ) }
                                    onClick={ () => setAttributes( { highContrast: ! highContrast } ) }
                                >
                                    { icon }
                                </Button>
                            </Tooltip>
                        </Toolbar>