@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
49 lines (48 loc) • 1.36 kB
TypeScript
import React from "react";
import { FieldsetProps } from "../fieldset";
export interface RadioGroupContextProps {
name: string;
defaultValue?: any;
value?: any;
onChange: (value: any) => void;
required?: boolean;
}
export declare const RadioGroupContext: React.Context<RadioGroupContextProps | null>;
export interface RadioGroupProps extends Omit<FieldsetProps, "onChange" | "errorPropagation" | "defaultValue" | "nativeReadOnly"> {
/**
* Collection of `<Radio />`-elements
*/
children: React.ReactNode;
/**
* Override internal name
*/
name?: string;
/**
* Default checked Radio
*/
defaultValue?: any;
/**
* Controlled state for Radio
*/
value?: any;
/**
* Returns current checked Radio in group
*/
onChange?: (value: any) => void;
/**
* Tells Fieldset if group is required
*/
required?: boolean;
}
/**
* Form radio group
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/radio)
* @see 🏷️ {@link RadioGroupProps}
* @example
* <RadioGroup legend="Får du AAP nå?">
* <Radio value="ja">Ja</Radio>
* <Radio value="Nei">Nei</Radio>
* </RadioGroup>
*/
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
export default RadioGroup;