Icon Button

[DEPRECATED] Icon button is a button without text that allows users to take actions.

 

Deprecated
Show details
Deprecated
Published: January 08, 2025
Updated: January 30, 2025

Variants

Variants contain different versions of the component depending on specific properties, such as state, size, colour, optional iconography, etc.

IconButton
Property Values Default
type Variant predefined | custom predefined
state Variant default | hover | disabled | pressed default

The IconButton is a singular component with different required props depending on whether a custom icon or predefined icon is used.

Icon button with predefined icon

Predefined Icons are a set of icons we have set up in this component for ease of use. They make use of our approved design system icons.


                                                        
                                                        
                                                            <IconButton icon="PlusIcon" accessibleName="Add Item" />
                                                        
                                                            

Icon button with custom icon

It should be noted that the IconButton will not apply any additional styling to custom icons. They should generally prefer to use currentColor to ensure colors are applied appropriately to the color/fill color depending on the type of custom icon provided.


                                                        
                                                        
                                                            <IconButton customIcon={<MyCustomIcon />} accessibleName="Accessible Name" />
                                                        
                                                            

                                                        
                                                        
                                                            import { css } from "@emotion/css";
                                                        
                                                        const MyCustomIcon(){
                                                          return <svg className={MyCustomIconStyles}><path d={iconPath}></svg>
                                                        }
                                                        
                                                        const MyCustomIconStyles = css({
                                                          fill: "currentColor",
                                                        });  
                                                        
                                                        <IconButton customIcon={<MyCustomIcon />} accessibleName="Accessible Name" />
                                                        
                                                            

Similar to an embedded SVG icon such as above, an image can also be used, for example:


                                                        
                                                        
                                                            import { css } from "@emotion/css";
                                                        
                                                        const MyCustomIcon(){
                                                          return <img className={MyCustomIconStyles} src={iconSrc} alt="Custom Icon" />;
                                                        }
                                                        
                                                        const MyCustomIconStyles = css({
                                                          width: "1rem",
                                                          height: "1rem"
                                                        });  
                                                        
                                                        <IconButton customIcon={<MyCustomIcon />} accessibleName="Accessible Name" />
                                                        
                                                            
IconButton
IconButton
type predefined state hover
IconButton
IconButton
type predefined state disabled
IconButton
IconButton
type custom state default
IconButton
IconButton
type custom state pressed
IconButton
IconButton
type custom state hover
IconButton
IconButton
type custom state disabled
IconButton
IconButton
type predefined state default
IconButton
IconButton
type predefined state pressed

Component dependencies

This component is internally dependent on the following components:


Help and support