UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

56 lines (49 loc) 1.29 kB
let { ChoiceGroup, IChoiceGroupOption, Fabric } = window.Fabric; interface IChoiceGroupBasicExampleState { imageKey: string; } class ChoiceGroupBasicExample extends React.Component<{}, IChoiceGroupBasicExampleState> { constructor(props: {}) { super(props); this.state = { imageKey: '' }; } public render() { return ( <div> <ChoiceGroup defaultSelectedKey="B" options={[ { key: 'A', text: 'Option A', 'data-automation-id': 'auto1' } as IChoiceGroupOption, { key: 'B', text: 'Option B' }, { key: 'C', text: 'Option C', disabled: true }, { key: 'D', text: 'Option D', disabled: true } ]} onChange={this._onChange} label="Pick one" required={true} /> </div> ); } private _onChange = (ev: React.FormEvent<HTMLInputElement>, option: any): void => { console.dir(option); }; } ReactDOM.render(<ChoiceGroupBasicExample />, document.getElementById('content'));