UNPKG

@workday/canvas-kit-preview-react

Version:

Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.

102 lines 4.46 kB
import React from 'react'; import { Themeable, ErrorType } from '@workday/canvas-kit-react/common'; import { FlexProps } from '@workday/canvas-kit-react/layout'; import { CSProps } from '@workday/canvas-kit-styling'; export interface RadioGroupProps extends Themeable, CSProps, FlexProps { /** * The type of error associated with the RadioGroup (if applicable). */ error?: ErrorType; } /** * Use `RadioGroup` to group a collection of `RadioGroup.RadioButton` components under a common `name`. * * ```tsx * <RadioGroup name="pizza-crust" value="thin"> * <RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton> * <RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton> * </RadioGroup> * ``` */ export declare const RadioGroup: import("@workday/canvas-kit-react/common").ElementComponentM<"div", RadioGroupProps & Partial<{ 'aria-describedby': string | undefined; name: string; value: string | number | undefined; onChange(event: React.ChangeEvent<HTMLInputElement>): void; }> & {} & {}, { onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; state: { value: string | number | undefined; name: string; 'aria-describedby': string | undefined; inputRef: React.MutableRefObject<HTMLInputElement | undefined>; }; events: {}; }> & { /** * `RadioGroup.RadioButton` renders an `<input type="radio" />` and its associated `<label>` (using `children` as the label's contents). * This component should satisfy most use cases; use `RadioGroup.Label` and its sub components if you require more flexibility. * * ```tsx * <RadioGroup name="pizza-crust" value="thin"> * <RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton> * <RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton> * </RadioGroup> * ``` */ RadioButton: import("@workday/canvas-kit-react/common").ElementComponentM<"input", import("./RadioLabel").RadioLabelProps, { onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; state: { value: string | number | undefined; name: string; 'aria-describedby': string | undefined; inputRef: React.MutableRefObject<HTMLInputElement | undefined>; }; events: {}; }>; /** * Use `RadioGroup.Label` instead of `RadioGroup.Radio` if you need direct access to the label and the radio input. * This will render a `<label>` that wraps an `<input type="radio" />` and a `<span>` for the label text. * * ```tsx * <RadioGroup name"pizza-crust" value="deep-dish"> * <RadioGroup.Label> * <RadioGroup.Label.Input value="deep-dish" /> * <RadioGroup.Label.Text>Deep dish</RadioGroup.Label.Text> * </RadioGroup.Label> * </RadioGroup> * ``` */ Label: import("@workday/canvas-kit-react/common").ElementComponentM<"label", import("./RadioLabel").RadioLabelProps, { onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; state: { value: string | number | undefined; name: string; 'aria-describedby': string | undefined; inputRef: React.MutableRefObject<HTMLInputElement | undefined>; }; events: {}; }> & { Input: import("@workday/canvas-kit-react/common").ElementComponentM<"input", import("./RadioLabel").RadioLabelProps, { onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; state: { value: string | number | undefined; name: string; 'aria-describedby': string | undefined; inputRef: React.MutableRefObject<HTMLInputElement | undefined>; }; events: {}; }>; Text: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("@workday/canvas-kit-react/text").TextProps & React.HTMLAttributes<HTMLSpanElement>, { onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; state: { value: string | number | undefined; name: string; 'aria-describedby': string | undefined; inputRef: React.MutableRefObject<HTMLInputElement | undefined>; }; events: {}; }>; }; }; //# sourceMappingURL=RadioGroup.d.ts.map