import * as React from 'react'; import { Checkbox, ICheckboxProps } from '@fluentui/react/lib/Checkbox'; import { Link } from '@fluentui/react/lib/Link'; import { Stack } from '@fluentui/react/lib/Stack'; // Optional extra props to pass through to the input element const inputProps: ICheckboxProps['inputProps'] = { onFocus: () => console.log('Checkbox is focused'), onBlur: () => console.log('Checkbox is blurred'), // Passing data-* props is supported but currently requires casting ...({ 'data-foo': 'bar' } as any), }; // Used to add spacing between example checkboxes const stackTokens = { childrenGap: 10 }; export const CheckboxOtherExample: React.FunctionComponent = () => { // Only for the first checkbox, which is controlled const [isChecked, setIsChecked] = React.useState(true); const onChange = React.useCallback( (ev?: React.FormEvent, checked?: boolean): void => { setIsChecked(!!checked); }, [], ); return ( {/* Checkbox doesn't currently support passing arbitrary native props through the root. However, props for the hidden checkbox input element can be passed through `inputProps`. */} ); }; function _renderLabelWithLink() { return ( Custom-rendered label with a link to{' '} Microsoft home page ); }