Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: Add JSDoc and update README for BlockCard component #68114

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/block-editor/src/components/block-card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const MyBlockCard = () => (
icon={ paragraph }
title="Paragraph"
description="Start with the basic building block of all narrative."
name="Custom Block"
/>
);
```
Expand All @@ -45,6 +46,12 @@ The title of the block.

The description of the block.

#### name

- **Type:** `String`

The custom name of the block.

## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
29 changes: 29 additions & 0 deletions packages/block-editor/src/components/block-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,35 @@ import { unlock } from '../../lock-unlock';

const { Badge } = unlock( componentsPrivateApis );

/**
* A card component that displays block information including title, icon, and description.
* Can be used to show block metadata and navigation controls for parent blocks.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md
*
* @example
* ```jsx
* function Example() {
* return (
* <BlockCard
* title="My Block"
* icon="smiley"
* description="A simple block example"
* name="Custom Block"
* />
* );
* }
* ```
*
* @param {Object} props Component props.
* @param {string} props.title The title of the block.
* @param {string|Object} props.icon Block icon component or string identifier.
* @param {string} props.description Optional description of the block.
* @param {Object} [props.blockType] Deprecated: Object containing block type data.
* @param {string} [props.className] Additional classes to apply to the card.
* @param {string} [props.name] Custom block name to display before the title.
* @return {Element} Block card component.
t-hamano marked this conversation as resolved.
Show resolved Hide resolved
*/
function BlockCard( { title, icon, description, blockType, className, name } ) {
if ( blockType ) {
deprecated( '`blockType` property in `BlockCard component`', {
Expand Down
Loading