Skip to main content

IconButton

An icon-only button with an optional tooltip.

VEF-specific component. Not part of Ant Design.

When to Use

  • Compact action buttons in tables, toolbars, or cards where space is limited.
  • When the icon is self-explanatory but a tooltip improves accessibility.

Basic Usage

import { IconButton } from '@vef-framework-react/components';
import { Pencil } from 'lucide-react';

export default function Demo() {
return (
<IconButton
icon={<Pencil />}
tip="Edit"
onClick={() => console.log('edit')}
/>
);
}

With Tooltip Placement

import { IconButton } from '@vef-framework-react/components';
import { Trash2 } from 'lucide-react';

export default function Demo() {
return (
<IconButton
icon={<Trash2 />}
tip="Delete"
placement="bottom"
onClick={() => console.log('delete')}
/>
);
}

Delayed Tooltip

<IconButton
icon={<Settings />}
tip="Settings"
tipDelay={500}
/>

In a Table Column

{
title: 'Actions',
width: 80,
render: (_, record) => (
<Space>
<IconButton
icon={<Pencil size={14} />}
tip="Edit"
onClick={() => openEdit(record)}
/>
<IconButton
icon={<Trash2 size={14} />}
tip="Delete"
onClick={() => confirmDelete(record)}
/>
</Space>
),
}

API

IconButton extends Button props except icon, iconPosition, type, htmlType, autoInsertSpace, color, variant, ghost, danger, and block. Plus:

PropTypeDefaultDescription
iconReactElement<LucideProps>requiredLucide icon element
tipReactNodeTooltip content
tipDelaynumberTooltip show delay in milliseconds
placementTooltipPlacementTooltip placement
size'large' | 'middle' | 'small'Button size
disabledbooleanfalseDisable the button
loadingbooleanfalseShow loading state
onClick(e) => voidClick handler

Best Practices

  • Always provide a tip for accessibility — screen readers and keyboard users rely on it.
  • Use Lucide icons from lucide-react (already a dependency of @vef-framework-react/components).
  • For icon buttons that need permission checks, wrap with PermissionGate or use OperationButton.