Skip to content

Commit

Permalink
Add JS docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishit30G committed Jan 16, 2025
1 parent a80b4b2 commit dd074ee
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/block-editor/src/components/rich-text/toolbar-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@
import { Fill, ToolbarButton } from '@wordpress/components';
import { displayShortcut } from '@wordpress/keycodes';

/**
* RichTextToolbarButton component displays a button in the rich text toolbar.
*
* @param {Object} props The component props.
* @param {string} props.name Name of the button.
* @param {string} props.shortcutType Type of the shortcut.
* @param {string} props.shortcutCharacter Character of the shortcut.
* @param {Object} props.props Props to pass to the `ToolbarButton` component.
*
* @return {Element} The toolbar button element.
*
* @example
* ```jsx
* function MyRichTextToolbarButton() {
* return (
* <RichTextToolbarButton
* name="my-button"
* icon={ icon }
* title="My button"
* onClick={ () => {
* console.log( 'Button clicked!' );
* }
* shortCutType="primary"
* shortCutCharacter="b"
* />
* );
* }
* ```
*/
export function RichTextToolbarButton( {
name,
shortcutType,
Expand Down

0 comments on commit dd074ee

Please sign in to comment.