ion-button
Buttons provide a clickable element, which can be used in forms, or anywhere that needs simple, standard button functionality. They may display text, icons, or both. Buttons can be styled with several attributes to look a specific way.
Basic Usage
Expand
This property lets you specify how wide the button should be. By default, buttons are inline blocks, but setting this property will change the button to a full-width block element.
Shape
This property lets you specify the shape of the button. By default, buttons are rectangular with a small border radius, but setting this to "round" will change the button to a rounded element.
Fill
This property determines the background and border color of the button. By default, buttons have a solid background unless the button is inside of a toolbar, in which case it has a transparent background.
Size
This property specifies the size of the button. Setting this property will change the height and padding of a button.
Icons
Theming
Colors
CSS Custom Properties
Properties
buttonType
button-typestring'button'color
"primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.color"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefinedundefineddisabled
true, the user cannot interact with the button.disabledbooleanfalsedownload
downloadstring | undefinedundefinedexpand
"block" for a full-width button or to "full" for a full-width button with square corners and no left or right borders.expand"block" | "full" | undefinedundefinedfill
"clear" for a transparent button that resembles a flat button, to "outline" for a transparent button with a border, or to "solid" for a button with a filled background. The default fill is "solid" except inside of a toolbar, where the default is "clear".fill"clear" | "default" | "outline" | "solid" | undefinedundefinedform
formHTMLFormElement | string | undefinedundefinedhref
hrefstring | undefinedundefinedmode
mode"ios" | "md"undefinedrel
relstring | undefinedundefinedrouterAnimation
href.undefined((baseEl: any, opts?: any) => Animation) | undefinedundefinedrouterDirection
href.router-direction"back" | "forward" | "root"'forward'shape
"round" for a button with more rounded corners.shape"round" | undefinedundefinedsize
"small" for a button with less height and padding, to "default" for a button with the default height and padding, or to "large" for a button with more height and padding. By default the size is unset, unless the button is inside of an item, where the size is "small" by default. Set the size to "default" inside of an item to make it a standard size button.size"default" | "large" | "small" | undefinedundefinedstrong
true, activates a button with a heavier font weight.strongbooleanfalsetarget
href is provided. Special keywords: "_blank", "_self", "_parent", "_top".targetstring | undefinedundefinedtype
type"button" | "reset" | "submit"'button'Events
| Name | Description | Bubbles |
|---|---|---|
ionBlur | Emitted when the button loses focus. | true |
ionFocus | Emitted when the button has focus. | true |
Methods
No public methods available for this component.
CSS Shadow Parts
| Name | Description |
|---|---|
native | The native HTML button or anchor element that wraps all child elements. |
CSS Custom Properties
| Name | Description |
|---|---|
--background | Background of the button |
--background-activated | Background of the button when pressed. Note: setting this will interfere with the Material Design ripple. |
--background-activated-opacity | Opacity of the button when pressed |
--background-focused | Background of the button when focused with the tab key |
--background-focused-opacity | Opacity of the button when focused with the tab key |
--background-hover | Background of the button on hover |
--background-hover-opacity | Opacity of the background on hover |
--border-color | Border color of the button |
--border-radius | Border radius of the button |
--border-style | Border style of the button |
--border-width | Border width of the button |
--box-shadow | Box shadow of the button |
--color | Text color of the button |
--color-activated | Text color of the button when pressed |
--color-focused | Text color of the button when focused with the tab key |
--color-hover | Text color of the button when hover |
--opacity | Opacity of the button |
--padding-bottom | Bottom padding of the button |
--padding-end | Right padding if direction is left-to-right, and left padding if direction is right-to-left of the button |
--padding-start | Left padding if direction is left-to-right, and right padding if direction is right-to-left of the button |
--padding-top | Top padding of the button |
--ripple-color | Color of the button ripple effect |
--transition | Transition of the button |
Slots
| Name | Description |
|---|---|
| `` | Content is placed between the named slots if provided without a slot. |
end | Content is placed to the right of the button text in LTR, and to the left in RTL. |
icon-only | Should be used on an icon in a button that has no text. |
start | Content is placed to the left of the button text in LTR, and to the right in RTL. |