5dd7713346
* Replace classnames with clsx within woocommerce-blocks. * Undo unnecessary change to getClassnames const. * Replace classnames with clsx within woocommerce-admin. * Add changelog. * Update the pnpm lock file * Address lint. * Address lint errors for the block-library. |
||
---|---|---|
.. | ||
README.md | ||
index.js | ||
style.scss |
README.md
TextToolbarButton
TextToolbarButton is used in Toolbar for text buttons which show isToggled
state.
Notes:
- Gutenberg core has
ToolbarGroup
andToolbarButton
in progress. When these are available this component may not be needed. - Gutenberg core
html
block uses regularButton
in toolbar, and setsis-active
class to trigger "active" styling when button is toggled on.
Usage
Example: two text buttons to select edit modes for cart block.
<BlockControls>
<Toolbar>
<TextToolbarButton
onClick={ toggleFullCartMode }
isToggled={ isFullCartMode }
>
{ __( 'Full Cart', 'woocommerce' ) }
</TextToolbarButton>
<TextToolbarButton
onClick={ toggleFullCartMode }
isToggled={ ! isFullCartMode }
>
{ __( 'Empty Cart', 'woocommerce' ) }
</TextToolbarButton>
</Toolbar>
</BlockControls>
We're hiring! Come work with us!
🐞 Found a mistake, or have a suggestion? Leave feedback about this document here.