x
1
2
3
4
5
6
7
<!-- Text Area --><textarea name="text_area" id="text_area" rows="3" class="input"></textarea><!-- Text Area With Auto Grow --><textarea name="text_area_with_auto_grow" id="text_area_with_auto_grow" rows="auto" class="input"></textarea>
1
2
3
4
5
<%# Text Area %><%= text_area_tag "text_area", nil, rows: 3, class: "input" %><%# Text Area With Auto Grow %><%= text_area_tag "text_area_with_auto_grow", nil, rows: "auto", class: "input" %>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
.input { appearance: none; background-color: var(--input-background, var(--color-bg)); border: 1px solid var(--input-border-color, var(--color-border)); border-radius: var(--input-radius, var(--rounded-md)); font-size: var(--input-font-size, var(--text-sm)); inline-size: var(--input-inline-size, var(--size-full)); min-block-size: var(--input-block-size, var(--size-10)); padding: var(--input-padding, 0.5rem 0.75rem); option { padding-block: 2px; } &:is(textarea[rows=auto]) { field-sizing: content; max-block-size: calc(10lh + var(--size-6)); min-block-size: calc(3lh + var(--size-6)); } &:is(select):not([multiple], [size]) { background-image: url("select-arrow.svg"); background-position: center right var(--size-2); background-repeat: no-repeat; background-size: var(--size-4) auto; } &::file-selector-button { font-weight: var(--font-medium); margin-inline-end: var(--size-2); } &:user-invalid { border-color: var(--color-negative); } &:user-invalid ~ .invalid-feedback { display: flex; } &:disabled { cursor: not-allowed; opacity: var(--opacity-50); }}/* Hide invalid feedback by default */.invalid-feedback { display: none;}/* Containers that act like (and contain) inputs */.input--actor { input { border: 0; inline-size: 100%; outline: 0; } img:not([class]) { filter: var(--input-icon-color, var(--color-filter-text)); } &:focus-within { outline: var(--input-outline-size, 2px) solid var(--color-selected-dark); outline-offset: var(--border-2); }}/* Checkbox, radio, and range */.checkbox, .radio { accent-color: var(--color-primary); transform: scale(1.15);}.range { accent-color: var(--color-primary);}/* Styles that are shared between components */:is(.input, .checkbox, .radio, .range) { &:focus-visible { outline: var(--input-outline-size, 2px) solid var(--color-selected-dark); outline-offset: var(--border-2); } .field_with_errors & { border-color: var(--color-negative); }}
Java Script is not required or multiple files are needed, check the notes.
Text area with auto grow is not supported in all browsers.