React Native MantineInputs

SegmentedControl

Segmented button group selector

Import: import { SegmentedControl } from 'react-native-mantine';

Usage

import { useState } from 'react';
import { SegmentedControl } from 'react-native-mantine';

const [value, setValue] = useState('react');

<SegmentedControl
  value={value}
  onChange={setValue}
  data={[
    { value: 'react', label: 'React' },
    { value: 'vue', label: 'Vue' },
    { value: 'svelte', label: 'Svelte' },
  ]}
  fullWidth
/>

Props

PropTypeDefaultDescription
valuestringCurrent selected value (controlled)
defaultValuestringDefault value (uncontrolled)
onChange(value: string) => voidCalled when value changes
data (required)(string | SegmentedControlItem)[]Data for segments
sizeMantineSize'md'SegmentedControl size
colorMantineColor'blue'SegmentedControl color
radiusMantineNumberSize'sm'Key of theme.radius or any valid value to set border-radius
disabledbooleanfalseDisabled state
orientation'horizontal' | 'vertical''horizontal'Orientation of the segments
fullWidthbooleanfalseSets width to 100% of parent
transitionDurationnumber200Transition duration in ms
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm