reablocks
Version:
Component library for React
52 lines (50 loc) • 1.44 kB
TypeScript
import { RadioTheme } from './RadioTheme';
import { default as React, FC, LegacyRef, ReactNode } from 'react';
export interface RadioProps {
/**
* Whether the radio is checked or not.
* Required only if `Radio` is used independently outside a `RadioGroup`.
* If `Radio` is used inside a `RadioGroup` then the value is internally set depending upon if the `value` is same as the selected value.
*/
checked?: boolean;
/**
* Label for the radio.
*/
label?: string | ReactNode;
/**
* Whether the radio is disabled or not.
*/
disabled?: boolean;
/**
* Additional class names to apply to the radio.
*/
className?: string;
/**
* Size of the radio.
*/
size?: 'small' | 'medium' | 'large' | string;
/**
* Event handler for when the radio is changed.
*/
onChange?: (value: boolean) => void;
/**
* Event handler for when the radio is blurred.
*/
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
/**
* Value passed to the form when used inside a `RadioGroup`.
* Required when `Radio` is used within a `RadioGroup`
*/
value?: any;
/**
* Theme for the Radio.
*/
theme?: RadioTheme;
}
export interface RadioRef {
/**
* Reference to the radio element.
*/
ref?: LegacyRef<HTMLDivElement>;
}
export declare const Radio: FC<RadioProps & RadioRef>;