Skip to content

Commit

Permalink
[form-builder] Make TextInput’s textarea resizable
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Jan 25, 2021
1 parent 1ecca18 commit 323539e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/@sanity/form-builder/src/inputs/TextInput.tsx
Expand Up @@ -3,9 +3,16 @@ import {useId} from '@reach/auto-id'
import {FormField} from '@sanity/base/components'
import {TextSchemaType} from '@sanity/types'
import {TextArea} from '@sanity/ui'
import styled from 'styled-components'
import PatchEvent, {set, unset} from '../PatchEvent'
import {Props} from './types'

const StyledTextArea = styled(TextArea)`
&[data-as='textarea'] {
resize: vertical;
}
`

const TextInput = React.forwardRef(function TextInput(
props: Props<string, TextSchemaType>,
forwardedRef: ForwardedRef<HTMLTextAreaElement>
Expand Down Expand Up @@ -33,7 +40,7 @@ const TextInput = React.forwardRef(function TextInput(
__unstable_presence={presence}
inputId={inputId}
>
<TextArea
<StyledTextArea
id={inputId}
customValidity={errors && errors.length > 0 ? errors[0].item.message : ''}
value={value || ''}
Expand Down

1 comment on commit 323539e

@vercel
Copy link

@vercel vercel bot commented on 323539e Jan 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.