Skip to content

feat(split-panel): add toggleIconOpen/toggleIconClosed props for custom toggle icons - #4766

Draft
ernst-dev wants to merge 1 commit into
mainfrom
feat/splitpanel-toggle-icon
Draft

feat(split-panel): add toggleIconOpen/toggleIconClosed props for custom toggle icons#4766
ernst-dev wants to merge 1 commit into
mainfrom
feat/splitpanel-toggle-icon

Conversation

@ernst-dev

Copy link
Copy Markdown
Member

Summary

Implements the feature requested in #4059.

Adds toggleIconOpen and toggleIconClosed props to SplitPanelProps that allow consumers to override the built-in open/close icons on the toggle button with any React.ReactNode (typically an SVG icon).

New API

interface SplitPanelProps {
  /**
   * Custom icon for the close/collapse button (panel open state).
   * Replaces the built-in close/angle icon.
   */
  toggleIconOpen?: React.ReactNode;

  /**
   * Custom icon for the open/expand button (panel closed state).
   * Replaces the built-in angle-up / angle-left icon.
   */
  toggleIconClosed?: React.ReactNode;
}

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:

  • Close button in (bottom + side positions, open state)
  • Inline open button in (bottom position, closed state)
  • Side open button in (side position, closed state)

The AppLayout toolbar trigger button (outside SplitPanel) is not affected.

Files changed

File Change
/ props
Thread icons through to close + bottom-open buttons
Thread through to side open button
6 unit tests (all passing)
Dev page with custom SVG icons

Testing

  • Build: ✅ passes
  • Unit tests: ✅ 6/6 passing (default icons preserved, custom icons rendered, bottom + side positions)
  • ESLint: ✅ clean

Related

Closes #4059

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add support for custom split-panel toggle icon in SplitPanel / AppLayout

1 participant