The nav is a grouped set of links that take the user to another page, or tab through parts of a page. It comes in horizontal or vertical with several different variants.
<%= pb_rails("nav", props: {title: "Menu", link: "#"}) do %> <%= pb_rails("nav/item", props: { text: "Photos", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Music", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Video", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Files", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: {title: "Browse", link: "#"}) do %> <%= pb_rails("nav/item", props: { icon_left: "newspaper", text: "News Feed" }) %> <%= pb_rails("nav/item", props: { icon_left: "comments-alt", link: "#", text: "Messages", active: true }) %> <%= pb_rails("nav/item", props: { icon_left: "calendar-check", icon_right: "angle-down", link: "#", text: "Events" }) %> <%= pb_rails("nav/item", props: { icon_left: "users", link: "#", text: "Friends" }) %> <%= pb_rails("nav/item", props: { icon_left: "users-class", icon_right: "angle-down", link: "#", text: "Groups" }) %> <% end %>
Icon used needs to be square. Icon size is 24px by 24px.
<%= pb_rails("nav", props: {title: "Browse", link: "#"}) do %> <%= pb_rails("nav/item", props: { image_url: "https://upload.wikimedia.org/wikipedia/commons/0/00/Apple_News_icon_%28macOS%29.png", text: "News Feed" }) %> <%= pb_rails("nav/item", props: { image_url: "https://p7.hiclipart.com/preview/928/339/723/messages-iphone-apple-imessage-iphone-thumbnail.jpg", link: "#", text: "Messages", active: true }) %> <%= pb_rails("nav/item", props: { image_url: "https://www.clipartmax.com/png/middle/103-1038653_circle-icons-calendar-svg-event-icon.png", icon_right: "angle-down", link: "#", text: "Events" }) %> <%= pb_rails("nav/item", props: { image_url: "https://www.pngitem.com/pimgs/m/228-2289227_find-friends-icon-png-image-iphone-find-my.png", link: "#", text: "Friends" }) %> <%= pb_rails("nav/item", props: { image_url: "https://img.favpng.com/18/5/20/blue-human-behavior-silhouette-area-communication-png-favpng-wLT3QYknSwc68uu9GAUHGS5FY_t.jpg", icon_right: "angle-down", link: "#", text: "Groups" }) %> <% end %>
<%= pb_rails("nav", props: { highlight: false }) do %> <%= pb_rails("nav/item", props: { text: "All Categories", active: true, link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Food", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Digital", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Design Art", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: {borderless: true}) do %> <%= pb_rails("nav/item", props: { text: "Photos", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Music", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Video", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Files", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: { variant: "subtle" }) do %> <%= pb_rails("nav/item", props: { text: "Overview", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Albums", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Events", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Discography", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Listeners", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: {variant: "subtle"}) do %> <%= pb_rails("nav/item", props: { icon_left: "city", text: "City", link: "#" }) %> <%= pb_rails("nav/item", props: { icon_left: "user-friends", text: "People", link: "#", icon_right: "angle-down" }) %> <%= pb_rails("nav/item", props: { icon_left: "user-tie", text: "Business", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { icon_left: "theater-masks", text: "Entertainment", link: "#" }) %> <%= pb_rails("nav/item", props: { icon_left: "salad", text: "Food", link: "#", icon_right: "angle-down" }) %> <%= pb_rails("nav/item", props: { icon_left: "sunglasses", text: "Style", link: "#" }) %> <%= pb_rails("nav/item", props: { icon_left: "child", text: "Childern", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: {variant: "subtle", highlight: false}) do %> <%= pb_rails("nav/item", props: { text: "Dashboard", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Statistics", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Pages", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: { orientation: "vertical", variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %> <% end %>
All Nav variants' navItems accept our global Spacing (padding, margin) props for custom spacing requirements. This example uses paddingY="xxs" and margin="none" on the bold variant to show this in action!
<%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#", padding_y:"xxs", margin:"none" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true, padding_y:"xxs", margin:"none" }) %> <%= pb_rails("nav/item", props: { text: "Service", link: "#", padding_y:"xxs", margin:"none" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#", padding_y:"xxs", margin:"none" }) %> <% end %>
All Nav variants' navItems accept the following props for customizing font:
fontSize
/ font_size
defaults to normal
, also accepts small
fontWeight
/ font_weight
defaults to regular
, also accepts bold
and bolder
<%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#", font_weight:"bolder", font_size:"small" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true, font_weight:"bolder", font_size:"small" }) %> <%= pb_rails("nav/item", props: { text: "Service", link: "#", font_weight:"bolder", font_size:"small" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#", font_weight:"bolder", font_size:"small" }) %> <% end %>
The collapsible
prop allows users to create a nested, collapsible nav. Pass collapsible
to any NavItem and pass that navItem any number of NavItems as children to create a collapsible nav.
<%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "Overview", link: "#", collapsible: true, icon_left:"city" }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "City", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "People", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Business", link: "#" }) %> <% end %> <% end %> <%= pb_rails("nav/item", props: { text: "Albums", link: "#", active: true, collapsible: true, icon_left: "theater-masks" }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "Entertainment", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Food", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Style", link: "#" }) %> <% end %> <% end %> <%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#", collapsible: true, icon_left: "city" }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "City", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "People", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Business", link: "#" }) %> <% end %> <% end %> <% end %>
Collapsible Navs optionally accept the following props:
collapsibleTrail
/ collapsible_trail
, enables a vertical guideline to the left of the collapsible nav's childreniconRight
optionally accepts an array of 2 icon values; the first is used as the default icon when the node is collapsed, the second is toggled when the node is expanded. If only 1 icon value is passed, the icon will not toggle between collapsible states.<%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "Overview", link: "#", collapsible: true, icon_left:"city", collapsible_trail: true, font_weight:"bolder", font_size:"small", icon_right:["plus", "minus"] }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "City", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "People", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "Business", link: "#", font_size:"small", margin_y:"none" }) %> <% end %> <% end %> <%= pb_rails("nav/item", props: { text: "Albums", link: "#", active: true, collapsible: true, icon_left: "theater-masks", collapsible_trail: true, font_weight:"bolder", font_size:"small", icon_right:["plus", "minus"] }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "Entertainment", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "Food", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "Style", link: "#", font_size:"small", margin_y:"none" }) %> <% end %> <% end %> <%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#", collapsible: true, icon_left: "city", collapsible_trail: true, font_weight:"bolder", font_size:"small", icon_right:["plus", "minus"] }) do %> <%= pb_rails("nav", props: { variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "City", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "People", link: "#", font_size:"small", margin_y:"none" }) %> <%= pb_rails("nav/item", props: { text: "Business", link: "#", font_size:"small", margin_y:"none" }) %> <% end %> <% end %> <% end %>
<%= pb_rails("nav", props: { orientation: "horizontal" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: { orientation: "horizontal", variant: "bold" }) do %> <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %> <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %> <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %> <% end %>
<%= pb_rails("nav", props: {title: "Users", link: "#"}) do %> <%= pb_rails("nav/item", props: { link: "#", active: true }) do%> <%= pb_rails("user", props: { name: "Anna Black", territory: "PHL", title: "Remodeling Consultant", orientation: "horizontal", align: "left", avatar_url: "https://randomuser.me/api/portraits/women/44.jpg" }) %> <% end %> <%= pb_rails("nav/item", props: { link: "#" }) do%> <%= pb_rails("user", props: { name: "Julie Hamilton", territory: "PHL", title: "Inside Sales Agent", orientation: "horizontal", align: "left", avatar_url: "https://randomuser.me/api/portraits/women/45.jpg" }) %> <% end %> <%= pb_rails("nav/item", props: { link: "#" }) do%> <%= pb_rails("user", props: { name: "Dennis Wilks", territory: "PHL", title: "Senior Remodeling Consultant", orientation: "horizontal", align: "left", avatar_url: "https://randomuser.me/api/portraits/men/44.jpg" }) %> <% end %> <%= pb_rails("nav/item", props: { link: "#" }) do%> <%= pb_rails("user", props: { name: "Ronnie Martin", territory: "PHL", title: "Customer Development Representative", orientation: "horizontal", align: "left", avatar_url: "https://randomuser.me/api/portraits/men/46.jpg" }) %> <% end %> <% end %>
<%= pb_rails("nav") do %> <%= pb_rails("nav/item", props: { icon_left: "newspaper", text: "News Feed" }) %> <%= pb_rails("nav/item", props: { icon_left: "comments-alt", link: "#", text: "Messages", active: true }) %> <%= pb_rails("nav/item", props: { icon_left: "calendar-check", icon_right: "angle-down", link: "#", text: "Events" }) %> <%= pb_rails("nav/item", props: { icon_left: "users", link: "#", text: "Friends" }) %> <%= pb_rails("nav/item", props: { icon_left: "users-class", icon_right: "angle-down", link: "#", text: "Groups" }) %> <% end %>
<%= pb_rails("nav", props: {title: "Popular Websites", link: "#"}) do %> <%= pb_rails("nav/item", props: { text: "Google", link: "https://www.google.com/", target: "_blank" }) %> <%= pb_rails("nav/item", props: { text: "YouTube", link: "https://www.youtube.com/", target: "_blank" }) %> <%= pb_rails("nav/item", props: { text: "Facebook", link: "https://www.facebook.com/", target: "_blank" }) %> <%= pb_rails("nav/item", props: { text: "Amazon", link: "https://www.amazon.com/", target: "_blank" }) %> <% end %>
Props | Type | Values |
---|---|---|
max_width |
array
|
xs
sm
md
lg
xl
xxl
0
none
|
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
|
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
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
children |
proc
|
Props | Type | Values | Default |
---|---|---|---|
link |
string
|
#
|
|
title |
string
|
||
orientation |
enum
|
vertical
horizontal
|
vertical
|
variant |
enum
|
normal
subtle
bold
|
normal
|
highlight |
boolean
|
true
|
|
borderless |
boolean
|
false
|