[BUG] ShowButton ignores custom `startIcon` when `hideText=true`, causing double icon display
Describe the bug
When hideText=true is passed to ShowButton, the button body always renders
<VisibilityOutlined /> regardless of any custom startIcon prop provided by the user.
This causes two icons to appear simultaneously — the custom icon (rendered as startIcon)
and the hardcoded VisibilityOutlined (rendered as children).
Steps To Reproduce
<ShowButton
recordItemId={1}
hideText
startIcon={<InsertDriveFileIcon />}
/>
Both InsertDriveFileIcon (as startIcon) and the default icon VisibilityOutlined (as children) are displayed.
Expected behavior
Only InsertDriveFileIcon is displayed.
Packages
- @refinedev/cli: 2.16.49
- @refinedev/core: 4.58.0
- @refinedev/devtools: 1.2.17
- @refinedev/inferencer: 4.7.1
- @refinedev/kbar: 1.3.17
- @refinedev/mui: 5.22.0
- @refinedev/nextjs-router: 6.2.3
- @refinedev/react-hook-form: 4.10.2
- @refinedev/simple-rest: 5.0.11
- @refinedev/supabase: 5.9.8
Additional Context
Root Cause
In the current implementation, when hideText=true, the button children are hardcoded to <VisibilityOutlined fontSize="small" {...svgIconProps} /> and the children prop passed by the user is ignored:
{hideText ? (
<VisibilityOutlined fontSize="small" {...svgIconProps} />
) : (
children ?? label
)}
Suggested Fix
Use the startIcon prop (if provided) as the icon instead of always falling back to VisibilityOutlined:
const resolvedIcon = startIcon ?? <VisibilityOutlined fontSize="small" {...svgIconProps} />;
{hideText ? resolvedIcon : children ?? label}
Hi! I'd like to work on this issue if it's available.
It looks like the ShowButton component always renders VisibilityOutlined when hideText=true, ignoring a custom startIcon prop. I can update the implementation so it uses startIcon when provided and falls back to VisibilityOutlined otherwise.