跳到主要内容
版本:v8

ion-segment-button

shadow

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

基本用法

布局

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

主题

CSS Shadow Parts

CSS 自定义属性

属性

contentId

说明The id of the segment content.
属性content-id
类型string | undefined
默认值undefined

disabled

说明If true, the user cannot interact with the segment button.
属性disabled
类型boolean
默认值false

layout

说明Set the layout of the text and icon in the segment.
属性layout
类型"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined
默认值'icon-top'

mode

说明The mode determines which platform styles to use.

这是一个虚拟属性,在初始化时设置一次,之后更改其值不会更新组件。
属性mode
类型"ios" | "md"
默认值undefined

type

说明The type of the button.
属性type
类型"button" | "reset" | "submit"
默认值'button'

value

说明The value of the segment button.
属性value
类型number | string
默认值'ion-sb-' + ids++

事件

该组件没有可用的事件。

方法

该组件没有可用的公共方法。

CSS Shadow Parts

Name说明
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 自定义属性

Name说明
--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

插槽

该组件没有可用的插槽。