You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance documentation for useRenderAppenderWithLimit hook by adding detailed parameter descriptions and usage examples for default, button type, and custom appenders.
Copy file name to clipboardExpand all lines: hooks/use-render-appender-with-limit/readme.md
+77-1Lines changed: 77 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,14 @@ There are times when we need more granular control over how many blocks can be a
4
4
5
5
The hook will return either false or the block appender, depending on the maximum limit you pass in. Behind the scenes, it handles the heavy lifting by fetching and counting the inner blocks for your block, then conditionally returning the appender only when allowed.
6
6
7
+
## Parameters
8
+
9
+
-**`limit`** (`number`): The maximum number of inner blocks allowed. When the current number of inner blocks reaches this limit, the appender will not be rendered.
10
+
-**`appender`** (`React.ComponentType`, optional): The React component to render as the block appender when under the limit. Defaults to `InnerBlocks.DefaultBlockAppender` if not provided.
> For appenders that require props (like `ButtonBlockAppender` needing `rootClientId`), pass a function component that returns the appender with the required props.
> For a fully functional custom appender that can actually add blocks, you would need to implement the block insertion logic using WordPress's `useBlockEditor` hook or similar APIs. The example above shows the structure, but in practice, you'd typically use one of WordPress's built-in appenders like `ButtonBlockAppender` or `DefaultBlockAppender` for functionality.
0 commit comments