# Icon buttons [Icon buttons](https://m3.material.io/components/icon-buttons/overview) help people take minor actions with one tap. There are two variants of icon buttons. ![2 types of icon buttons](assets/buttons/iconbuttons_types.png) 1. Default icon button 2. Toggle icon button **Note:** Images use various dynamic color schemes. ## Design & API documentation * [Material 3 (M3) spec](https://m3.material.io/components/icon-buttons/overview) * [API reference](https://developer.android.com/reference/com/google/android/material/button/package-summary) ## Anatomy ![Anatomy of an icon button ](assets/buttons/iconbuttons_anatomy.png) 1. Icon 2. Container More details on anatomy items in the [component guidelines](https://m3.material.io/components/icon-buttons/guidelines#1f6f6121-e403-4d82-aa6a-5ab276f4bc4c). ## M3 Expressive update Before you can use `Material3Expressive` component styles, follow the [`Material3Expressive` themes setup instructions](https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md#material3expressive-themes). Icon buttons can vary in size, shape, and width. 1. Five sizes 2. Two shapes 3. Three widths Icon buttons now have a wider variety of shapes and sizes, changing shape when selected. When placed in button groups, icon buttons interact with each other when pressed. [More on M3 Expressive](https://m3.material.io/blog/building-with-m3-expressive) **Types and naming:** * Default and toggle (selection) * Color styles are now configurations. (filled, tonal, outlined, standard) **Shapes:** * Round and square options * Shape morphs when pressed * Shape morphs when selected **Sizes:** * Extra small * Small (default) * Medium * Large * Extra large **Widths:** * Narrow * Default * Wide ## Key properties ### Styles and theme attributes Element | Style | Theme Attribute ---------------------------- | ------------------------------------------------- | --------------- **Default style** | `Widget.Material3.Button.IconButton` | `?attr/materialIconButtonStyle` **Filled Icon Button** | `Widget.Material3.Button.IconButton.Filled` | `?attr/materialIconButtonFilledStyle` **Filled Tonal Icon Button** | `Widget.Material3.Button.IconButton.Filled.Tonal` | `?attr/materialIconButtonFilledTonalStyle` **Outlined Icon Button** | `Widget.Material3.Button.IconButton.Outlined` | `?attr/materialIconButtonOutlinedStyle` See the full list of [styles](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/button/res/values/styles.xml) and [attrs](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/button/res/values/attrs.xml). ## Variants of icon buttons ### Default icon button * Default icon buttons can open other elements, such as a menu or search. * Default icon buttons should use filled icons. ### Toggle icon button * Toggle icon buttons can represent binary actions that can be toggled on and off, such as favorite or bookmark. * Each icon button has as an optional toggle behavior, which lets people select and unselect the button. Toggle buttons remain highlighted when selected, and are styled differently than the default, non-toggle buttons. * Toggle buttons should use an outlined icon when unselected, and a filled version of the icon when selected. **There are four icon button color styles, in order of emphasis:** 1. Filled 2. Tonal 3. Outlined 4. Standard For the highest emphasis, use the filled style. For the lowest emphasis, use standard. ![Diagram of default and toggle icon buttons in 4 color styles.](assets/buttons/iconbuttons_color.png) The default (left) and toggle (right) icon buttons are available in all four color styles ## Code implementation **Note:** The examples below show how to create an icon button using `Button` which will be inflated to `MaterialButton` when using a Material theme. There is a known performance issue where `MaterialButton` takes longer to initialize when compared to `ImageButton` or `AppCompatImageButton`, in large part because `MaterialButton` extends from `AppCompatButton` which supports more than just icon buttons. Consider using those pure icon button alternatives if the extra latency causes a noticeable issue for your app. ![Code implementation for icon buttons.](assets/buttons/iconbuttons_codeimplementation.png) Standard, filled unselected, filled selected, filled tonal, and outlined icon buttons ### Adding standard icon button The following example shows a standard icon button. !["Standard icon button example for Android over a white background."](assets/buttons/icon-button-standard.png) In the layout: ```xml