跳到主要内容
版本:v7

ion-segment-button

shadow

分段按钮是 segment 内的一组相关按钮。它们以水平行形式显示。通过将分段的 value 设置为分段按钮的 value,可以将某个分段按钮设为默认选中状态。一次只能选中一个分段按钮。

基本用法

布局

layout 属性默认设置为 "icon-top"。当分段按钮同时包含图标和标签时,图标会显示在标签上方。可以通过将 layout 属性设置为 "icon-bottom""icon-start""icon-end" 来改变此行为,分别将图标显示在标签下方、标签起始位置(LTR 中为左侧,RTL 中为右侧)或标签结束位置(LTR 中为右侧,RTL 中为左侧)。

主题定制

CSS Shadow Parts

CSS 自定义属性

属性

disabled

DescriptionIf true, the user cannot interact with the segment button.
Attributedisabled
Typeboolean
Defaultfalse

layout

DescriptionSet the layout of the text and icon in the segment.
Attributelayout
Type"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined
Default'icon-top'

mode

DescriptionThe 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.
Attributemode
Type"ios" | "md"
Defaultundefined

type

DescriptionThe type of the button.
Attributetype
Type"button" | "reset" | "submit"
Default'button'

value

DescriptionThe value of the segment button.
Attributevalue
Typenumber | string
Default'ion-sb-' + ids++

事件

No events available for this component.

方法

No public methods available for this component.

CSS Shadow Parts

NameDescription
indicatorThe indicator displayed on the checked segment button.
indicator-backgroundThe background element for the indicator displayed on the checked segment button.
nativeThe native HTML button element that wraps all child elements.

CSS 自定义属性

NameDescription
--backgroundBackground of the segment button
--background-checkedBackground of the checked segment button
--background-focusedBackground of the segment button when focused with the tab key
--background-focused-opacityOpacity of the segment button background when focused with the tab key
--background-hoverBackground of the segment button on hover
--background-hover-opacityOpacity of the segment button background on hover
--border-colorColor of the segment button border
--border-radiusRadius of the segment button border
--border-styleStyle of the segment button border
--border-widthWidth of the segment button border
--colorColor of the segment button
--color-checkedColor of the checked segment button
--color-focusedColor of the segment button when focused with the tab key
--color-hoverColor of the segment button on hover
--indicator-box-shadowBox shadow on the indicator for the checked segment button
--indicator-colorColor of the indicator for the checked segment button
--indicator-heightHeight of the indicator for the checked segment button
--indicator-transformTransform of the indicator for the checked segment button
--indicator-transitionTransition of the indicator for the checked segment button
--margin-bottomBottom margin of the segment button
--margin-endRight margin if direction is left-to-right, and left margin if direction is right-to-left of the segment button
--margin-startLeft margin if direction is left-to-right, and right margin if direction is right-to-left of the segment button
--margin-topTop margin of the segment button
--padding-bottomBottom padding of the segment button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the segment button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the segment button
--padding-topTop padding of the segment button
--transitionTransition of the segment button

插槽

No slots available for this component.