Area where user can enter larger amounts of text. Commonly used in forms.
<%= pb_rails("textarea", props: { label: "auto", placeholder: "Resize Auto", resize: "auto" }) %> <br/> <%= pb_rails("textarea", props: { label: "vertical", placeholder: "Resize Vertical", resize: "vertical" }) %> <br/> <%= pb_rails("textarea", props: { label: "both", placeholder: "Resize Both", resize: "both" }) %> <br/> <%= pb_rails("textarea", props: { label: "horizontal", placeholder: "Resize Horizontal", resize: "horizontal" }) %>
Textarea w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
<% text_area_2_value = "Counting characters!" %> <% text_area_3_value = "This counter prevents the user from exceeding the maximum number of allowed characters. Just try it!" %> <% text_area_4_value = "This counter alerts the user that they have exceeded the maximum number of allowed characters." %> <%= pb_rails("textarea", props: { character_count: 0, id: "text-area-1", label: "Count Only", onkeyup: "handleChange1(event)", }) %> <%= pb_rails("textarea", props: { character_count: text_area_2_value.length, id: "text-area-2", label: "Max Characters", max_characters: 100, onkeyup: "handleChange2(event, 100)", value: text_area_2_value, }) %> <%= pb_rails("textarea", props: { character_count: text_area_3_value.length, id: "text-area-3", label: "Max Characters w/ Blocker", max_characters: 100, onkeyup: "handleChange3(event, 100)", value: text_area_3_value, }) %> <%= pb_rails("textarea", props: { character_count: text_area_4_value.length, error: "Too many characters!", id: "text-area-4", label: "Max Characters w/ Error", max_characters: 75, onkeyup: "handleChange4(event, 75)", value: text_area_4_value, }) %> <script type="text/javascript"> const characterCount1 = document.querySelector("#text-area-1 .pb_caption_kit_xs") const characterCount2 = document.querySelector("#text-area-2 .pb_caption_kit_xs") const characterCount3 = document.querySelector("#text-area-3 .pb_caption_kit_xs") const characterCount4 = document.querySelector("#text-area-4 .pb_caption_kit_xs") const textArea3 = document.querySelector("#text-area-3 textarea") const textArea4 = document.querySelector("#text-area-4 textarea") const handleChange1 = (event) => { characterCount1.innerHTML = event.target.value.length } const handleChange2 = (event, maxCharacters) => { characterCount2.innerHTML = `${event.target.value.length} / ${maxCharacters}` } const handleChange3 = (event, maxCharacters) => { if (event.target.value.length > maxCharacters) { textArea3.value = event.target.value.substring(0, maxCharacters) } characterCount3.innerHTML = `${textArea3.value.length} / ${maxCharacters}` } const handleChange4 = (event, maxCharacters) => { characterCount4.innerHTML = `${textArea4.value.length} / ${maxCharacters}` } </script>
Do not use for small text amounts (use Text Input instead). Avoid using textarea without validation if it is required and using with validation if not required.
Props | Type | Values |
---|---|---|
max_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
min_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
z_index |
array
|
1
2
3
4
5
6
7
8
9
10
|
number_spacing |
array
|
tabular
|
shadow |
array
|
none
deep
deeper
deepest
|
line_height |
array
|
tightest
tighter
tight
normal
loose
looser
loosest
|
display |
array
|
block
inline_block
inline
flex
inline_flex
none
|
cursor |
array
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
crosshair
text
verticalText
alias
copy
move
noDrop
notAllowed
grab
grabbing
eResize
nResize
neResize
nwResize
sResize
seResize
swResize
wResize
ewResize
nsResize
neswResize
nwseResize
colResize
rowResize
allScroll
zoomIn
zoomOut
|
flex_direction |
array
|
row
column
rowReverse
columnReverse
|
flex_wrap |
array
|
wrap
nowrap
wrapReverse
|
justify_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
justify_self |
array
|
auto
start
end
center
stretch
|
align_items |
array
|
flexStart
flexEnd
start
end
center
baseline
stretch
|
align_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_self |
array
|
auto
start
end
center
stretch
baseline
|
flex |
array
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_grow |
array
|
1
0
|
flex_shrink |
array
|
1
0
|
order |
array
|
1
2
3
4
5
6
7
8
9
10
11
12
|
position |
array
|
relative
absolute
fixed
sticky
|
hover |
array
|
|
border_radius |
array
|
none
xs
sm
md
lg
xl
rounded
|
text_align |
array
|
start
end
left
right
center
justify
justify-all
match-parent
|
overflow |
array
|
visible
hidden
scroll
auto
|
truncate |
array
|
1
2
3
4
5
|
left |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
top |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
right |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
bottom |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
vertical_align |
array
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
min_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
max_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
overflow_x |
array
|
visible
hidden
scroll
auto
|
overflow_y |
array
|
visible
hidden
scroll
auto
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
classname |
string
|
|
dark |
boolean
|
|
group_hover |
boolean
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
html_options |
hashprop
|
|
children |
proc
|
|
style |
hashprop
|
Props | Type | Values | Default |
---|---|---|---|
error |
string
|
||
inline |
boolean
|
false
|
|
label |
string
|
||
method |
string
|
||
name |
string
|
||
placeholder |
string
|
||
resize |
enum
|
none
both
horizontal
vertical
auto
|
none
|
rows |
number
|
4
|
|
value |
string
|
||
character_count |
string
|
||
onkeyup |
string
|
||
max_characters |
string
|