import * as React from 'react'; import { TextField } from '@fluentui/react/lib/TextField'; import { useBoolean } from '@fluentui/react-hooks'; import { lorem } from '@fluentui/example-data'; import { Stack, IStackProps, IStackStyles } from '@fluentui/react/lib/Stack'; const stackStyles: Partial = { root: { width: 650 } }; const stackTokens = { childrenGap: 50 }; const dummyText: string = lorem(100); const columnProps: Partial = { tokens: { childrenGap: 15 }, styles: { root: { width: 300 } }, }; export const TextFieldMultilineExample: React.FunctionComponent = () => { const containerRef = React.useRef(null); const [multiline, { toggle: toggleMultiline }] = useBoolean(false); const onChange = (_: React.FormEvent, newText: string): void => { const newMultiline = newText.length > 50; if (newMultiline !== multiline) { toggleMultiline(); } }; return ( {/* When using autoAdjustHeight, if the TextField extends past the container's height and the container allows scrolling, deleting a line scrolls the container to the top. To avoid this, use the scrollable container's ref in scrollContainerRef to preserve the scrollTop property. */}
); };