| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 |
|---|---|---|---|---|
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
Overlays help shift focus by dimming or masking background content. This kit supports gradient and solid color modes, with adjustable opacity to suit the context.
<%= pb_rails("overlay") do %> <%= pb_rails("table", props: { size: "sm" }) do %> <thead> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <th>Column 4</th> <th>Column 5</th> </tr> </thead> <tbody> <% 7.times do %> <tr> <td>Value 1</td> <td>Value 2</td> <td>Value 3</td> <td>Value 4</td> <td>Value 5</td> </tr> <% end %> </tbody> <% end %> <% end %>
Optionally, you can pass multi-directional options (x or y) to the position key, which creates multiple overlays.
Your color is still applied as the starting edge to both overlays, and each mask will fade to transparent moving toward its opposite edge, ending at the size value you set.
NOTE: Multi-directional overlays share the available container space, so passing full or a percentage string greater than 50% to a multi-directional overlay will cause your masks to overlap at the midline of your container. As a best practice, we do not recommend exceeding a percentage size of 25% when using multi-directional overlays.
<%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light" }) do %> <%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %> <% 15.times do %> <%= pb_rails("flex/flex_item") do %> <%= pb_rails("card") do %> Card content <% end %> <% end %> <% end %> <% end %> <% end %>
Pass the dynamic prop to make the overlay render while the scrollbar isn't at either end on the scrollbar.
<%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light", dynamic: true }) do %> <%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %> <% 15.times do %> <%= pb_rails("flex/flex_item") do %> <%= pb_rails("card") do %> Card content <% end %> <% end %> <% end %> <% end %> <% end %>
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 |
|---|---|---|---|---|
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
| Value 1 | Value 2 | Value 3 | Value 4 | Value 5 |
To toggle an overlay, add a button with an event handler. Remove the overlay container to reveal the underlying content. Re-wrap the overlay container to add the overlay back.
<div id="outer-container"> <%= pb_rails("overlay", props: { id: "overlay-container", overflow: "hidden" }) do %> <div id="underlying-table"> <%= pb_rails("table", props: { size: "sm" }) do %> <thead> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <th>Column 4</th> <th>Column 5</th> </tr> </thead> <tbody> <% 7.times do %> <tr> <td>Value 1</td> <td>Value 2</td> <td>Value 3</td> <td>Value 4</td> <td>Value 5</td> </tr> <% end %> </tbody> <% end %> </div> <% end %> <%= pb_rails("button", props: { text: "Show More", id: "show-more-button", variant: "link", full_width: true, icon: "chevron-down", icon_right: true }) %> <%= pb_rails("button", props: { text: "Show Less", id: "show-less-button", variant: "link", full_width: true, icon: "chevron-up", icon_right: true }) %> </div> <script type="text/javascript"> document.addEventListener("DOMContentLoaded", () => { const showMoreButton = document.getElementById("show-more-button"); const showLessButton = document.getElementById("show-less-button"); const overlayContainer = document.getElementById("overlay-container"); const underlyingTable = document.getElementById("underlying-table"); const outerContainer = document.getElementById("outer-container"); showLessButton.style.display = "none"; underlyingTable.style.height = "200px"; const showMore = () => { outerContainer.appendChild(underlyingTable); outerContainer.appendChild(showLessButton); showMoreButton.style.display = "none"; showLessButton.style.display = "flex"; underlyingTable.style.height = "auto"; }; const showLess = () => { overlayContainer.appendChild(underlyingTable); showMoreButton.style.display = "flex"; showLessButton.style.display = "none"; underlyingTable.style.height = "200px"; }; showMoreButton.addEventListener("click", showMore); showLessButton.addEventListener("click", showLess); }); </script>
Pass the scroll_bar_none prop to hide the scrollbar from view. This is particularly helpful for small containers where the scrollbar may occupy too much space.
<%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light", scroll_bar_none: true }) do %> <%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %> <% 15.times do %> <%= pb_rails("flex/flex_item") do %> <%= pb_rails("card") do %> Card content <% end %> <% end %> <% end %> <% end %> <% end %>
| 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 |
|---|---|---|---|
color |
enum
|
card_light
bg_light
card_dark
bg_dark
black
white
success
error
|
card_light
|
dynamic |
false
|
false
|
|
gradient |
boolean
|
true
false
|
|
size |
string
|
||
scroll_bar_none |
boolean
|
true
false
|
false
|
full_screen |
boolean
|
true
false
|
|
layout |
genericobject
|
||
opacity |
enum
|
opacity_1
opacity_2
opacity_3
opacity_4
opacity_5
opacity_6
opacity_7
opacity_8
opacity_9
opacity_10
|