[フレーム]
Skip to main content
An OutSystems Company →
Version: v8

ion-button

shadow

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 have display: inline-block, but setting this property will change the button to a full-width element with display: block.

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

Accessibility

Buttons are built to be accessible, but may need some adjustments depending on their content. The button component renders a native button element which allows it to take advantage of the functionality that a native button provides.

Overflowing Text Content

There are many cases where a button's text content may overflow the container. It is recommended to wrap the text inside of the button when this happens so that all of the text can still be read. The button component will automatically adjust its height to accommodate the extra lines of text.

The button text does not automatically wrap to the next line when the text is too long to fit. In order to make the text wrap, the ion-text-wrap class can be added, which will set the white-space property to "normal". This will become the default in a future major release.

info

The max-width style is set on the button below for demo purposes only. Text wrapping will work with a dynamic button width.

Properties

buttonType

Description The type of button.
Attribute button-type
Type string
Default 'button'

color

Description The color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.
Attribute color
Type "danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined
Default undefined

disabled

Description If true, the user cannot interact with the button.
Attribute disabled
Type boolean
Default false

download

Description This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want).
Attribute download
Type string | undefined
Default undefined

expand

Description Set to "block" for a full-width button or to "full" for a full-width button with square corners and no left or right borders.
Attribute expand
Type "block" | "full" | undefined
Default undefined

fill

Description Set to "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".
Attribute fill
Type "clear" | "default" | "outline" | "solid" | undefined
Default undefined

form

Description The HTML form element or form element id. Used to submit a form when the button is not a child of the form.

This is a virtual property that is set once during initialization and will not update if you change its value after the initial render.
Attribute form
Type HTMLFormElement | string | undefined
Default undefined

href

Description Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
Attribute href
Type string | undefined
Default undefined

mode

Description The mode determines which platform styles to use.

This is a virtual property that is set once during initialization and will not update if you change its value after the initial render.
Attribute mode
Type "ios" | "md"
Default undefined

rel

Description Specifies the relationship of the target object to the link object. The value is a space-separated list of link types.
Attribute rel
Type string | undefined
Default undefined

routerAnimation

Description When using a router, it specifies the transition animation when navigating to another page using href.
Attribute undefined
Type ((baseEl: any, opts?: any) => Animation) | undefined
Default undefined

routerDirection

Description When using a router, it specifies the transition direction when navigating to another page using href.
Attribute router-direction
Type "back" | "forward" | "root"
Default 'forward'

shape

Description Set to "round" for a button with more rounded corners.
Attribute shape
Type "round" | undefined
Default undefined

size

Description Set to "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.
Attribute size
Type "default" | "large" | "small" | undefined
Default undefined

strong

Description If true, activates a button with a heavier font weight.
Attribute strong
Type boolean
Default false

target

Description Specifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top".
Attribute target
Type string | undefined
Default undefined

type

Description The type of the button.
Attribute type
Type "button" | "reset" | "submit"
Default 'button'

Events

NameDescriptionBubbles
ionBlurEmitted when the button loses focus.true
ionFocusEmitted when the button has focus.true

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeThe native HTML button or anchor element that wraps all child elements.

CSS Custom Properties

  • iOS
  • MD
NameDescription
--backgroundBackground of the button
--background-activatedBackground of the button when pressed. Note: setting this will interfere with the Material Design ripple.
--background-activated-opacityOpacity of the button when pressed
--background-focusedBackground of the button when focused with the tab key
--background-focused-opacityOpacity of the button when focused with the tab key
--background-hoverBackground of the button on hover
--background-hover-opacityOpacity of the background on hover
--border-colorBorder color of the button
--border-radiusBorder radius of the button
--border-styleBorder style of the button
--border-widthBorder width of the button
--box-shadowBox shadow of the button
--colorText color of the button
--color-activatedText color of the button when pressed
--color-focusedText color of the button when focused with the tab key
--color-hoverText color of the button when hover
--opacityOpacity of the button
--padding-bottomBottom padding of the button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the button
--padding-topTop padding of the button
--ripple-colorColor of the button ripple effect
--transitionTransition of the button

Slots

NameDescription
``Content is placed between the named slots if provided without a slot.
endContent is placed to the right of the button text in LTR, and to the left in RTL.
icon-onlyShould be used on an icon in a button that has no text.
startContent is placed to the left of the button text in LTR, and to the right in RTL.

AltStyle によって変換されたページ (->オリジナル) /