import * as React from 'react'; import { TextField, ITextFieldStyles } from '@fluentui/react/lib/TextField'; import { Stack } from '@fluentui/react/lib/Stack'; const textFieldStyles: Partial = { fieldGroup: { width: 300 } }; const narrowTextFieldStyles: Partial = { fieldGroup: { width: 100 } }; const stackTokens = { childrenGap: 15 }; export const TextFieldControlledExample: React.FunctionComponent = () => { const [firstTextFieldValue, setFirstTextFieldValue] = React.useState(''); const [secondTextFieldValue, setSecondTextFieldValue] = React.useState(''); const onChangeFirstTextFieldValue = React.useCallback( (event: React.FormEvent, newValue?: string) => { setFirstTextFieldValue(newValue || ''); }, [], ); const onChangeSecondTextFieldValue = React.useCallback( (event: React.FormEvent, newValue?: string) => { if (!newValue || newValue.length <= 5) { setSecondTextFieldValue(newValue || ''); } }, [], ); return ( ); };