For Form Pills with longer text, the truncate global prop can be used to truncate the label within each Form Pill. See here for more information on the truncate global prop.
NOTE: For Rails Form Pills (not ones embedded within a React-rendered Typeahead or MultiLevelSelect), a unique id is required to enable the Tooltip functionality displaying the text or tag section of the Form Pill.
<% names = [ { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' }, { label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' }, { label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' }, { label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' }, { label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' }, ] %> <%= pb_rails("typeahead", props: { html_options: { style: { maxWidth: "240px" }}, id: "typeahead-form-pill", is_multi: true, options: names, label: "Truncation Within Typeahead", pills: true, truncate: "1", }) %> <%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %> <%= pb_rails("card", props: { max_width: "xs" }) do %> <%= pb_rails("form_pill", props: { name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo", avatar_url: "https://randomuser.me/api/portraits/women/44.jpg", tabindex: 0, truncate: "1", id: "truncation-1" }) %> <%= pb_rails("form_pill", props: { icon: "badge-check", text: "icon and a very long tag to show truncation", tabindex: 0, truncate: "1", id: "truncation-2" }) %> <%= pb_rails("form_pill", props: { text: "form pill long tag no tooltip show truncation", tabindex: 0, truncate: "1", }) %> <% end %>
For Form Pills with longer text, the wrapped prop can be used to wrap the label within each Form Pill.
Note: Avoid using the wrapped and small props together, as their styles conflict and may cause functionality issues.
<% names = [ { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' }, { label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' }, { label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' }, { label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' }, { label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' }, ] %> <%= pb_rails("typeahead", props: { html_options: { style: { maxWidth: "240px" }}, id: "typeahead-form-pill", is_multi: true, options: names, label: "Wrapped Within Typeahead", pills: true, wrapped: true, }) %> <%= pb_rails("caption", props: { text: "Form Pill Wrapped Text" }) %> <%= pb_rails("card", props: { max_width: "xs" }) do %> <%= pb_rails("form_pill", props: { name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo", avatar_url: "https://randomuser.me/api/portraits/women/44.jpg", tabindex: 0, wrapped: true, }) %> <%= pb_rails("form_pill", props: { icon: "badge-check", text: "icon and a very long tag to show wrapped text", tabindex: 0, wrapped: true, }) %> <%= pb_rails("form_pill", props: { text: "form pill long tag no tooltip show wrapped text", tabindex: 0, wrapped: true, }) %> <% end %>
By default textTransform = "none". If there is a need to enforce lowercase, please pass the textTransform = "lowercase prop.
The Status, Data, and Product colors highlighted above can be passed to the color prop. Primary is the default color. Form pills with a text tag, an avatar, or an icon with text tag can all receive the color prop.
<%= pb_rails("title", props: { text: "Status Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("form_pill", props: { text: "Primary", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "neutral", text: "Neutral", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "success", text: "Success", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "warning", text: "Warning", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "error", text: "Error", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "info", text: "Info", tabindex: 0, }) %> <%= pb_rails("title", props: { text: "Data Colors", tag: "h4", size: 4, margin_bottom: "sm", margin_top: "md" }) %> <%= pb_rails("form_pill", props: { color: "data_1", text: "Data 1", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_2", text: "Data 2", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_3", text: "Data 3", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_4", text: "Data 4", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_5", text: "Data 5", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_6", text: "Data 6", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_7", text: "Data 7", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "data_8", text: "Data 8", tabindex: 0, }) %> <%= pb_rails("title", props: { text: "Product Colors", tag: "h4", size: 4, margin_bottom: "sm", margin_top: "md" }) %> <%= pb_rails("form_pill", props: { color: "windows", text: "Windows", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "siding", text: "Siding", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "roofing", text: "Roofing", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "doors", text: "Doors", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "gutters", text: "Gutters", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "solar", text: "Solar", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "insulation", text: "Insulation", tabindex: 0, }) %> <%= pb_rails("form_pill", props: { color: "accessories", text: "Accessories", tabindex: 0, }) %>
| Props | Type | Values |
|---|---|---|
align_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_items |
enum | responsive
|
start
end
center
|
border_radius |
enum
|
none
xs
sm
md
lg
xl
rounded
|
cursor |
enum
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
|
dark |
boolean
|
true
false
|
flex |
enum | responsive
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_direction |
enum | responsive
|
row
column
rowReverse
columnReverse
|
flex_wrap |
enum | responsive
|
wrap
nowrap
wrapReverse
|
justify_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
line_height |
enum
|
loosest
looser
loose
normal
tight
tighter
tightest
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
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
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
width |
string
|
|
min_width |
string
|
|
max_width |
string
|
|
gap |
string | responsive
|
|
column_gap |
string | responsive
|
|
row_gap |
string | responsive
|
|
number_spacing |
enum
|
tabular
|
order |
enum | responsive
|
none
first
1
2
3
4
5
6
7
8
9
10
11
12
|
overflow_x |
enum
|
scroll
visible
hidden
auto
|
overflow_y |
enum
|
scroll
visible
hidden
auto
|
overflow |
enum
|
scroll
visible
hidden
auto
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
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
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
position |
enum
|
relative
absolute
fixed
sticky
static
|
shadow |
enum
|
none
deep
deeper
deepest
|
text_align |
enum | responsive
|
start
end
left
right
center
justify
justifyAll
matchParent
|
truncate |
enum
|
none
1
2
3
4
5
|
vertical_align |
enum | responsive
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
z_index |
enum | responsive
|
1
2
3
4
5
6
7
8
9
10
max
|
top |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
inset |
boolean
|
true
false
|
right |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
bottom |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
left |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
height |
string
|
|
max_height |
string
|
|
min_height |
string
|
|
hover |
object
|
|
group_hover |
boolean
|
true
false
|
| Props | Type | Values | Default |
|---|---|---|---|
text |
string
|
||
name |
string
|
||
on_click |
reactnode
|
||
avatar |
boolean
|
true
false
|
|
avatar_url |
string
|
||
size |
string
|
||
text_transform |
enum
|
none
lowercase
|
none
|
color |
enum
|
primary
neutral
success
warning
error
info
data_1
data_2
data_3
data_4
data_5
data_6
data_7
data_8
windows
siding
roofing
doors
gutters
solar
insulation
accessories
|
primary
|
tab_index |
number
|
||
icon |
string
|
||
wrapped |
reactnode
|
false
|
|
tabindex |
string
|