react-native-paper
Version:
Material design for React Native
71 lines • 1.7 kB
TypeScript
import * as React from 'react';
import { GestureResponderEvent } from 'react-native';
import type { ThemeProp } from '../../types';
export type Props = {
/**
* Value of the radio button
*/
value: string;
/**
* Status of radio button.
*/
status?: 'checked' | 'unchecked';
/**
* Whether radio is disabled.
*/
disabled?: boolean;
/**
* Function to execute on press.
*/
onPress?: (e: GestureResponderEvent) => void;
/**
* Custom color for unchecked radio.
*/
uncheckedColor?: string;
/**
* Custom color for radio.
*/
color?: string;
/**
* @optional
*/
theme?: ThemeProp;
/**
* testID to be used on tests.
*/
testID?: string;
};
/**
* Radio buttons allow the selection a single option from a set.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { View } from 'react-native';
* import { RadioButton } from 'react-native-paper';
*
* const MyComponent = () => {
* const [checked, setChecked] = React.useState('first');
*
* return (
* <View>
* <RadioButton
* value="first"
* status={ checked === 'first' ? 'checked' : 'unchecked' }
* onPress={() => setChecked('first')}
* />
* <RadioButton
* value="second"
* status={ checked === 'second' ? 'checked' : 'unchecked' }
* onPress={() => setChecked('second')}
* />
* </View>
* );
* };
*
* export default MyComponent;
* ```
*/
declare const RadioButton: ({ theme: themeOverrides, ...props }: Props) => React.JSX.Element;
export default RadioButton;
//# sourceMappingURL=RadioButton.d.ts.map