Skip to main content
Version: v7

ion-button

shadow

Buttonはクリック可能な要素を提供し、Form内や、標準の単機能なButton機能を必要とする任意の場所で使用できます。text、icon、またはその両方を表示できます。Buttonは、いくつかの属性を利用して特定の外観になるようにスタイル設定できます。

基本的な使い方

Expand

このプロパティでは、ボタンの幅を指定することができます。デフォルトでは、ボタンは display: inline-block を持ちますが、このプロパティを設定すると、ボタンは display: block を持つ全角要素に変更されます。

Shape

このプロパティは、ボタンの形状を指定することができます。デフォルトでは、ボタンは小さなボーダー半径を持つ長方形ですが、これを "round" に設定すると、ボタンは丸みを帯びた要素に変更されます。

Fill

この属性は、Buttonのbackgroundとborder-colorを設定します。デフォルトでは、Buttonはtoolbar内にない限り、backgroundは塗りつぶされます。toolbar内にある場合は、backgroundは透明になります。

Size

この属性は、Buttonのサイズを指定します。この属性を設定すると、Buttonの高さとpaddingが変更されます

Icons

テーマ

Colors

CSSカスタムプロパティ

プロパティ

buttonType

Descriptionボタンの種類です。
Attributebutton-type
Typestring
Default'button'

color

DescriptionThe 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.
Attributecolor
Type"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined
Defaultundefined

disabled

Descriptiontrueの場合、ユーザはボタンと対話することができません。
Attributedisabled
Typeboolean
Defaultfalse

download

DescriptionThis 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).
Attributedownload
Typestring | undefined
Defaultundefined

expand

DescriptionSet to "block" for a full-width button or to "full" for a full-width button with square corners and no left or right borders.
Attributeexpand
Type"block" | "full" | undefined
Defaultundefined

fill

DescriptionSet 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".
Attributefill
Type"clear" | "default" | "outline" | "solid" | undefined
Defaultundefined

form

DescriptionHTML のフォーム要素またはフォーム要素 ID。ボタンがフォームの子でない場合に、フォームを送信するために使用します。
Attributeform
TypeHTMLFormElement | string | undefined
Defaultundefined

href

DescriptionContains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
Attributehref
Typestring | undefined
Defaultundefined

mode

Descriptionmodeは、どのプラットフォームのスタイルを使用するかを決定します。
Attributemode
Type"ios" | "md"
Defaultundefined

rel

DescriptionSpecifies the relationship of the target object to the link object. The value is a space-separated list of link types.
Attributerel
Typestring | undefined
Defaultundefined

routerAnimation

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

routerDirection

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

shape

Descriptionround"` に設定すると、より角が丸いボタンになります。
Attributeshape
Type"round" | undefined
Defaultundefined

size

DescriptionSet 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.
Attributesize
Type"default" | "large" | "small" | undefined
Defaultundefined

strong

Descriptiontrueの場合、より重いFont Weightを持つボタンをアクティブにします。
Attributestrong
Typeboolean
Defaultfalse

target

DescriptionSpecifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top".
Attributetarget
Typestring | undefined
Defaultundefined

type

Descriptionボタンの種類です。
Attributetype
Type"button" | "reset" | "submit"
Default'button'

イベント

NameDescription
ionBlurボタンのフォーカスが外れたときに発行されます。
ionFocusボタンにフォーカスが当たっているときに発行されます。

メソッド

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeすべての子要素をラップするネイティブHTMLのボタンまたはアンカー要素です。

CSSカスタムプロパティ

NameDescription
--backgroundボタンの背景
--background-activatedボタンが押されたときの背景。注意:これを設定すると、Material Designの波紋に干渉します。
--background-activated-opacityボタンが押されたときの不透明度
--background-focusedタブキーでフォーカスしたときのボタンの背景
--background-focused-opacityタブキーでフォーカスしたときのボタンの不透明度
--background-hoverホバー時のボタンの背景
--background-hover-opacityホバー時の背景の不透明度
--border-colorボタンのボーダーカラー
--border-radiusボタンの境界半径
--border-styleボタンのボーダースタイル
--border-widthボタンのボーダー幅
--box-shadowボタンのボックスシャドウ
--colorボタンの文字色
--color-activatedボタンが押されたときの文字色
--color-focusedタブキーでフォーカスしたときのボタンの文字色
--color-hoverホバー時のボタンの文字色
--opacityボタンの不透明度
--padding-bottomボタンのBottom Padding
--padding-endボタンの向きが左から右の場合はRight Padding、右から左の場合はLeft Paddingとなります。
--padding-startボタンの向きが左から右の場合はLeft Padding、右から左の場合はRight Paddingとなります。
--padding-topボタンのTop Padding
--ripple-colorボタンリプルエフェクトの色
--transitionボタンの遷移

Slots

NameDescription
``slotがない状態で提供される場合、コンテンツは名前付きslotの間に配置されます。
endコンテンツは、LTRの場合はボタンテキストの右側に、RTLの場合は左側に配置されます。
icon-onlyテキストを持たないボタン内のアイコンに対して使用されるべきです。
startコンテンツは、LTRではボタンテキストの左側に、RTLでは右側に配置されます。