Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f
- Updated `IndexTable` component to hide checkboxes when `selectable` prop is `false` ([#4376](https://github.com/Shopify/polaris-react/pull/4376))
- [Accessibility] - Removes skeleton shimmer animation on devices that have Reduced motion setting enabled [#4460](https://github.com/Shopify/polaris-react/pull/4460)
- Added optional `compactTitle` prop to `Page` which removes margin between `title` and `subtitle` ([#4463](https://github.com/Shopify/polaris-react/pull/4463))
- Added `maxHeight` prop to `TextField` component to limit the height of multi-line inputs. ([#4476](https://github.com/Shopify/polaris-react/pull/4476))

### Bug fixes

Expand Down
5 changes: 4 additions & 1 deletion src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ interface NonMutuallyExclusiveProps {
max?: number | string;
/** Maximum character length for an input */
maxLength?: number;
/** Maximum height of the input element. Only applies when `multiline` is `true` */
maxHeight?: number | string;
/** Mimics the behavior of the native HTML attribute, limiting the minimum value */
min?: number | string;
/** Minimum character length for an input */
Expand Down Expand Up @@ -169,6 +171,7 @@ export function TextField({
autoComplete,
max,
maxLength,
maxHeight,
min,
minLength,
pattern,
Expand Down Expand Up @@ -354,7 +357,7 @@ export function TextField({
/>
) : null;

const style = multiline && height ? {height} : null;
const style = multiline && height ? {height, maxHeight} : null;

const handleExpandingResize = useCallback((height: number) => {
setHeight(height);
Expand Down