UNPKG

@fluentui/react-northstar

Version:
77 lines (76 loc) 3.56 kB
import { Accessibility, RadioGroupItemBehaviorProps } from '@fluentui/accessibility'; import * as React from 'react'; import * as PropTypes from 'prop-types'; import { UIComponentProps, ChildrenComponentProps } from '../../utils'; import { BoxProps } from '../Box/Box'; import { ComponentEventHandler, ShorthandValue, FluentComponentStaticProps } from '../../types'; export interface RadioGroupItemSlotClassNames { indicator: string; label: string; } export interface RadioGroupItemProps extends UIComponentProps, ChildrenComponentProps { /** Accessibility behavior if overridden by the user. */ accessibility?: Accessibility<RadioGroupItemBehaviorProps>; /** Whether or not radio item is checked. */ checked?: boolean; /** * Called after radio item checked state is changed. * @param event - React's original SyntheticEvent. * @param data - All props. */ onChange?: ComponentEventHandler<RadioGroupItemProps>; /** The label of the radio item. */ label?: ShorthandValue<BoxProps>; /** Initial checked value. */ defaultChecked?: boolean; /** A radio item can appear disabled and be unable to change states. */ disabled?: boolean; /** The radio item indicator can be customized. */ indicator?: ShorthandValue<BoxProps>; /** The checked radio item indicator can be customized. */ checkedIndicator?: ShorthandValue<BoxProps>; /** The HTML input name. */ name?: string; /** * Called after radio item is clicked. * @param event - React's original SyntheticEvent. * @param data - All props. */ onClick?: ComponentEventHandler<RadioGroupItemProps>; /** Whether should focus when checked */ shouldFocus?: boolean; /** The HTML input value. */ value?: string | number; /** A vertical radio group displays elements vertically. */ vertical?: boolean; } export declare const radioGroupItemClassName = "ui-radiogroup__item"; export declare const radioGroupItemSlotClassNames: RadioGroupItemSlotClassNames; export declare type RadioGroupItemStylesProps = Required<Pick<RadioGroupItemProps, 'disabled' | 'vertical' | 'checked'>>; /** * A RadioGroupItem represents single input element within a RadioGroup. * * @accessibility * Radio items need to be grouped to correctly handle accessibility. */ export declare const RadioGroupItem: (<TExtendedElementType extends React.ElementType<any> = "div">(props: React.RefAttributes<HTMLDivElement> & Omit<import("@fluentui/react-bindings").PropsOfElement<TExtendedElementType>, "as" | keyof RadioGroupItemProps> & { as?: TExtendedElementType; } & RadioGroupItemProps) => JSX.Element) & { propTypes?: React.WeakValidationMap<RadioGroupItemProps> & { as: React.Requireable<string | ((props: any, context?: any) => any) | (new (props: any, context?: any) => any)>; }; contextTypes?: PropTypes.ValidationMap<any>; /** * Called after radio item is clicked. * @param event - React's original SyntheticEvent. * @param data - All props. */ defaultProps?: Partial<RadioGroupItemProps & { as: "div"; }>; displayName?: string; readonly __PRIVATE_PROPS?: React.RefAttributes<HTMLDivElement> & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & { ref?: React.Ref<HTMLDivElement>; }, "as" | keyof RadioGroupItemProps> & { as?: "div"; } & RadioGroupItemProps; } & FluentComponentStaticProps<RadioGroupItemProps>;