Skip to content

Commit 5df759b

Browse files
feat(ui): restyle textarea field to match v4 design (#16427)
## Summary Restyles the Textarea field component to match the v4 design. ## Changes - Updated `packages/ui/src/fields/Textarea/index.css`: - Added hover state: border becomes visible on hover - Updated focus state: blue border (`--border-selected-strong`) - Fixed read-only styling: white background + gray border (was using disabled colors) - Added flex + gap to `.field-type__wrap` for proper spacing between input and description - Updated `test/v4/collections/Textarea/index.ts`: - Added proper field variants for testing: default, required, readOnly, disabled - Added defaultValues to readOnly/disabled fields so content is visible for testing ## Reference https://app.asana.com/1/10497086658021/project/1213409914712008/task/1214061555627404?focus=true --------- Co-authored-by: Patrik Kozak <35232443+PatrikKozak@users.noreply.github.com>
1 parent d6f0091 commit 5df759b

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

packages/ui/src/fields/Textarea/index.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,38 @@
55
flex-direction: column;
66
gap: var(--spacer-2);
77

8+
.field-type__wrap {
9+
display: flex;
10+
flex-direction: column;
11+
gap: var(--spacer-2);
12+
}
13+
814
textarea {
915
overflow-y: auto;
1016
resize: vertical;
1117
min-height: 3.75rem;
1218
height: auto;
1319
display: flex;
1420
field-sizing: content;
21+
22+
&:hover:not(:focus):not(:disabled) {
23+
border-color: var(--border-default-default);
24+
}
25+
26+
&:focus {
27+
border-color: var(--border-selected);
28+
}
1529
}
1630

1731
textarea:not(:empty) {
1832
min-height: calc(var(--rows) * var(--base) + 1rem + 0.125rem);
1933
}
2034

2135
&.read-only {
22-
.textarea-outer {
23-
background: var(--bg-disabled-default);
24-
color: var(--text-disabled-default);
36+
textarea {
37+
background: var(--bg-default-default);
38+
border-color: var(--border-default-default);
39+
color: var(--text-default);
2540
}
2641
}
2742

test/v4/collections/Textarea/index.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,32 @@ const TextareaFields: CollectionConfig = {
1616
{
1717
name: 'contentRequired',
1818
type: 'textarea',
19-
label: 'Content',
19+
label: 'Content Required',
2020
required: true,
2121
admin: {
22-
description: 'The main body content for this entry',
22+
description: 'This field is required',
2323
},
2424
},
2525
{
26-
name: 'contentDisabled',
26+
name: 'contentReadOnly',
2727
type: 'textarea',
28-
label: 'Content',
28+
label: 'Content Read Only',
29+
defaultValue:
30+
'Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers.',
2931
admin: {
3032
readOnly: true,
31-
description: 'The main body content for this entry',
33+
description: 'This field is read-only',
34+
},
35+
},
36+
{
37+
name: 'contentDisabled',
38+
type: 'textarea',
39+
label: 'Content Disabled',
40+
defaultValue:
41+
'Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers.',
42+
admin: {
43+
disabled: true,
44+
description: 'This field is disabled',
3245
},
3346
},
3447
],

0 commit comments

Comments
 (0)