Skip to main content

SegmentedButton

SegmentedButton component with Pressable as container, and supports full customization with different props. It has both hover and press effect that get picked from the color shades or if custom color is provided it auto generates those colors.

Usage

Primary
Secondary
Tertiary
function SegmentedButtonUsage() {
return <SegmentedButton data={buttons} />
}

SegmentedButtonIcons

Primary
Secondary
Tertiary
function SegmentedButtonIcons() {
return (
<View>
<SegmentedButton data={iconButtons} />
</View>
)
}

SegmentedButtonMultiSelect

Primary
Secondary
Tertiary
function SegmentedButtonMultiSelect() {
return <SegmentedButton data={buttons} multiSelect />
}

Status

Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
function SegmentedButtonStatuses() {
return (
<>
<SegmentedButton data={buttons} mode="filled" status="primary" />
<SegmentedButton data={buttons} mode="filled" status="accent" />
<SegmentedButton data={buttons} mode="filled" status="success" />
<SegmentedButton data={buttons} mode="filled" status="info" />
<SegmentedButton data={buttons} mode="filled" status="warning" />
<SegmentedButton data={buttons} mode="filled" status="error" />
</>
)
}

Size

Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
function SegmentedButtonSizes() {
return (
<View>
<SegmentedButton data={buttons} size="small" />
<SegmentedButton data={buttons} size="medium" />
<SegmentedButton data={buttons} size="large" />
</View>
)
}

Modes

Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
Primary
Secondary
Tertiary
function SegmentedButtonModes() {
return (
<View>
<SegmentedButton data={buttons} mode="filled" />
<SegmentedButton data={buttons} mode="tinted" />
<SegmentedButton data={buttons} mode="outlined" />
<SegmentedButton data={buttons} mode="plain" />
</View>
)
}

Disabled

Primary
Secondary
Tertiary
function SegmentedButtonDisabled() {
return <SegmentedButton data={buttons} disabled />
}

Custom SegmentedButtons

Primary
Secondary
Tertiary
function SegmentedButtonCustom() {
return (
<View>
<SegmentedButton
data={buttons}
style={[{backgroundColor: 'cyan'}]}
activeColor="cyan"
inactiveColor="burlywood"
/>
</View>
)
}

Props

PropData TypeDefault ValueDescription
ExtendsBaseUIProps--Inherits properties from BaseUIProps
dataControlButtonProps[]--List of props for control buttons
modeButtonMode--Mode of the button view
fullWidthboolean--Take the full width available
borderRadiusnumber--Control the border radius of the edge buttons
withVerticalDividerboolean--Show the vertical divider between the buttons
multiSelectboolean--Set to true for multiple select
activeColorstring--active color when the button is selected
inactiveColorstring--inactive color when the button is unselected
styleStyleProp<ViewStyle>--Container style
disabledboolean--Disable the whole control
onPress(value: string, selectedIndex: number) => void--OnPress callback with value
statusBlossomStatusprimary--
sizeBlossomSizemedium--