Import
import { IconButton } from '@contentful/f36-components';// orimport { IconButton } from '@contentful/f36-button';
Examples
Variants, sizes, and states match those of the Button component.
Variations
- Primary - For the most important actions in a scenario. While icon buttons can technically be styled as primary, they’re not recommended for primary actions due to their limited clarity compared to labeled buttons.
 - Secondary - For secondary actions, the most commonly used button type.
 - Positive - When the action has a positive connotation.
 - Negative - For destructive actions - when something can't be undone. For example, deleting entities.
 - Transparent - For having an unstyled button. Use this only on light backgrounds.
 
Sizes
The button has 3 different sizes:
Tooltip
A built-in Tooltip is available to provide users with additional context about the purpose when they hover over the button.
Props (API reference)
Open in StorybookName | Type | Default | 
|---|---|---|
| aria-label required   | string Aria label is required when using icon only  | |
| icon required   | ReactElement<any, string | JSXElementConstructor<any>> Expects any of the icon components  | |
| as | HTML Tag or React Component (e.g. div, span, etc) The element used for the root node.  | button  | 
| children  Deprecated  | ReactNode  | |
| className | string CSS class to be appended to the root element  | |
| isActive | false true Applies active styles  | false  | 
| isDisabled | false true Disabled interaction and applies disabled styles  | false  | 
| isFullWidth | false true Forces button to take 100% of the container  | |
| isLoading | false true Adds loading indicator icon and disables interactions  | |
| size | "small" "medium" "large" Determines size variation of IconButton component Note: 'large' is deprecated  | |
| testId | string A [data-test-id] attribute used for testing purposes  | |
| tooltipProps | CommonProps & WithEnhancedContent & Omit<TooltipInternalProps, "children"> The tooltip properties to be passed to the Tooltip component wrapping the IconButton  | |
| variant | "negative" "positive" "primary" "secondary" "transparent" Determines style variation of Button component  | secondary  | 
| withTooltip | false true Wrap the IconButton with a Tooltip to provide users with additional context about its purpose when they hover over it  | 
Accessibility
The IconButton component requires an aria-label to ensure full accessibility for screen readers.
For easier understanding, use tooltipProps and set its content to match the aria-label. It’s recommended to ensure tooltipProps and aria-label have the same content.