# Material Button `Material Button` is a customizable button component with updated visual styles. This button component has several built-in styles to support different levels of emphasis, as typically any UI will contain a few different buttons to indicate different actions. These levels of emphasis include: - raised button: A rectangular material button that lifts and displays ink reactions on press - unelevated button: A button made of ink that displays ink reactions on press but does not lift ## Design & API Documentation - [Material Design guidelines: Buttons](https://material.io/go/design-buttons) - [Class definition](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/button/MaterialButton.java) - [Class overview](https://developer.android.com/reference/com/google/android/material/button/MaterialButton.html) ## Usage The `MaterialButton` component provides a complete implementation of Material Design's button component. Example code of how to include the component in your layout: ```xml ``` For raised buttons, your theme's `colorAccent` provides the default background color of the component, and the text color is white by default. For unelevated buttons, your theme's `colorAccent` provides the default text color of the component, and the background color is transparent by default. ## Attributes The following attributes can be changed for Material Button: | Description | Relevant attributes | | -------------------------------------- | ----------------------------------- | | Button padding | `android:padding` \ | : : `android\:paddingLeft` \ : : : `android\:paddingRight` \ : : : `android\:paddingStart` \ : : : `android\:paddingEnd` \ : : : `android\:paddingTop` \ : : : `android\:paddingBottom` : | Button inset | `android:insetLeft` \ | : : `android\:insetRight` \ : : : `android\:insetTop` \ : : : `android\:insetBottom` : | Background color | `app:backgroundTint` \ | : : `app\:backgroundTintMode` : | Icon drawable | `app:icon` | | Padding between icon and button text | `app:iconPadding` | | Icon color | `app:iconTint` \ | : : `app\:iconTintMode` : | Padding at the start of a button when | `app:additionalPaddingStartForIcon` | : an icon is present : : | Padding at the end of a button when an | `app:additionalPaddingEndForIcon` | : icon is present : : | Stroke | `app:strokeColor` \ | : : `app\:strokeWidth` : | The radius of all four corners of the | `app:cornerRadius` | : button : : | Ripple | `app:rippleColor` | The following shows an example of setting `icon` and `iconPadding` attributes on a button: ```xml ``` ## Related Concepts If your app requires actions to be persistent and readily available, you can use [FloatingActionButton](FloatingActionButton.md) instead.