feat(split-panel): add toggleIconOpen/toggleIconClosed props for custom toggle icons - #4766
Draft
ernst-dev wants to merge 1 commit into
Draft
feat(split-panel): add toggleIconOpen/toggleIconClosed props for custom toggle icons#4766ernst-dev wants to merge 1 commit into
ernst-dev wants to merge 1 commit into
Conversation
Adds two new optional props to SplitPanelProps:
- `toggleIconOpen?: React.ReactNode` — custom icon shown on the
close/collapse button when the panel is open
- `toggleIconClosed?: React.ReactNode` — custom icon shown on the
open/expand button when the panel is closed
When provided, the custom node is passed as `iconSvg` to the
underlying InternalButton and `iconName` is set to `undefined` so
the built-in icon is suppressed. This applies to:
- The close button in `implementation.tsx` (bottom + side, open state)
- The inline open button in `implementation.tsx` (bottom, closed state)
- The side open button in `side.tsx` (side, closed state)
No changes to the AppLayout trigger button (that is outside SplitPanel).
- Unit tests: 6 passing (default icons preserved, custom icons rendered)
- Dev page: `pages/app-layout/split-panel-toggle-icon.page.tsx`
Closes #4059
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the feature requested in #4059.
Adds
toggleIconOpenandtoggleIconClosedprops toSplitPanelPropsthat allow consumers to override the built-in open/close icons on the toggle button with anyReact.ReactNode(typically an SVG icon).New API
How it works
When a custom icon is provided it is passed as to the underlying and is set to , suppressing the built-in icon. Applies to:
The AppLayout toolbar trigger button (outside SplitPanel) is not affected.
Files changed
Testing
Related
Closes #4059