Skip to main content

IIconButton

A component that displays an interactive icon button with hover and click states.

iconbuttoniconbutton

Example​

Simple icon button with click handler

const deleteButton: IIconButton = {
iconName: "delete.svg",
size: 20,
color: "#333333",
hoverColor: "#FF0000",
onClick: async () => {
try {
await deleteItem();
return {
actions: [Actions.showToast],
toastProps: [{
title: "Item deleted successfully",
type: ToastType.success
}]
};
} catch (error) {
return {
actions: [Actions.showToast],
toastProps: [{
title: "Failed to delete item",
type: ToastType.error
}]
};
}
},
isDisabled: false,
title: "Delete item"
}

Properties​

PropertyTypeDescription
iconNamestringThe button display icon. The icon image must be uploaded to the assets folder. Only the image name with the extension must be specified in this field. The icon is rendered at the size set in the size field.
iconHoverNamestringThe icon displayed while the cursor is over the button. The icon image must be uploaded to the assets folder. Only the image name with the extension must be specified in this field.
iconClickNamestringThe icon displayed while the button is being clicked. The icon image must be uploaded to the assets folder. Only the image name with the extension must be specified in this field.
colorstringIcon color. Can be "accent" or any CSS color value
hoverColorstringIcon color on hover action
clickColorstringIcon color on click action
sizenumberButton height and width value. Can be a number (pixels)
isFillbooleanDetermines if icon fill is needed
isStrokebooleanDetermines if icon stroke is needed
isDisabledbooleanSets the button to present a disabled state
isClickablebooleanSets cursor value to indicate clickability
onClick() => TReturnMessageSets a button callback function triggered when the button is clicked
idstringSets component id
titlestringData when user hover on icon (tooltip text)
tooltipIdstringTooltip id for advanced tooltip configuration
tooltipContentstringTooltip content text
classNamestringDefines the CSS class for styling the component. Can be used to override or extend the default component styles.