<%= pb_rails("title", props: {size: 4, text: "Row"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column"}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
inline | Type: Boolean
By default this prop is false which sets the flex container to take up the full width of its parent container. When the prop is set to true the flex container sets its width to be the same size as the containing items.
<%= pb_rails("title", props: {size: 4, text: "Row"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {inline: true}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column", inline:true}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
reverse | Type: Boolean
When set to true this prop will reverse the order of items in the flex container.
<%= pb_rails("title", props: {size: 4, text: "Row"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex",props:{reverse: true}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column" , reverse: true}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
wrap | Type: Boolean
When set to true this prop will move the next item in flex container to a new line if there is no more room.
<div class="flex-doc-example"> <%= pb_rails("title", props: {size: 4, text: "Wrap"}) %><br/> <%= pb_rails("flex", props: {wrap: true}) do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>4<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>5<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>6<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>7<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>8<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>9<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>10<% end %> <% end %> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "No Wrap"}) %><br/> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>4<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>5<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>6<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>7<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>8<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>9<% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px"}) do %>10<% end %> <% end %> </div>
<%= pb_rails("title", props: {size: 4, text: "None"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Around"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "around" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Evenly"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "evenly" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Between"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "between" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
<%= pb_rails("title", props: {size: 4, text: "Row"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "start" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "center" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{justify: "end" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %><br/> <div class="flex-doc-example tall"> <%= pb_rails("flex", props:{ justify: "start", orientation: "column" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example tall"> <%= pb_rails("flex", props:{justify: "center", orientation: "column" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example tall"> <%= pb_rails("flex", props:{ justify: "end", orientation: "column" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
<%= pb_rails("title", props: {size: 4, text: "Row"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ align: "start" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"none"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"xl"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ align: "center" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"none"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"xl"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ align: "end" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"none"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"xl"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ align: "baseline" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"none"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"xl"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ align: "stretch" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"none"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"xl"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{orientation: "column", align: "start" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{orientation: "column", align: "center" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{orientation: "column", align: "end" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{orientation: "column", align: "stretch" }) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div>
gap | row_gap | column_gap | Type: String | Hash | Values: xxs | xs | sm | md | lg | xl | none
Setting the gap prop sets the row_gap and the column_gap props to the same size and creates equal space within a flex container.
Setting the row_gap prop creates space between rows in a flex container.
Setting the column_gap prop creates space between columns in a flex container.
You can also set responsive values by passing a hash with device sizes and values.
<%= pb_rails("title", props: {size: 4, text: "Gap"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ gap: "xxs", wrap:true}) do %> <%40.times do |i|%> <%= pb_rails("flex/flex_item") do %> <%=i%> <% end %> <% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column Gap"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ column_gap: "lg"}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Row Gap"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props:{ orientation: "column", row_gap: "xl"}) do %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <%= pb_rails("flex/flex_item") do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Responsive"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: { gap: { xs: "none", sm: "sm", md: "md", lg: "lg", xl: "xl" }, wrap: true }) do %> <% 40.times do |i| %> <%= pb_rails("flex/flex_item") do %> <%=i%> <% end %> <% end %> <% end %> </div>
display_flex | Type: Booleanflex | Type: String | Values: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12fixed_size | Type: String | Values: Any CSS px or % valuegrow | Type: Booleanshrink | Type: Booleanorder | Type: String | Values: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | first
Flex is a short hand to set the flex item to take up (x) amount of available space
Setting Flex to 1 is equal to setting the grow & shrink prop to true
Setting Flex to 0 is equal to setting the grow & shrink prop to false
If grow & shrink are true, grow will take precedence an the flex item will take up as much space as possible, then if other elements are added shrink would allow other items to squish inside the flex container
display_flex will either be true or false. If true, then the class will be applied to the kit
<%= pb_rails("title", props: {size: 4, text: "Display Flex"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex/flex_item",props: { gap:"sm", display_flex: true }) do %> <%= pb_rails("flex/flex_item") do %>We<% end %> <%= pb_rails("flex/flex_item") do %>Are<% end %> <%= pb_rails("flex/flex_item") do %>Being<% end %> <%= pb_rails("flex/flex_item") do %>Flexed<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex",props: { gap:"sm" }) do %> <%= pb_rails("flex/flex_item", props: { grow: true }) do %>I'm growing<% end %> <%= pb_rails("flex/flex_item") do %>1<% end %> <%= pb_rails("flex/flex_item") do %>2<% end %> <%= pb_rails("flex/flex_item") do %>3<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Shrink"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: { gap: "sm"}) do %> <%= pb_rails("flex/flex_item", props: {shrink: true}) do %> I'm shrinking<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>3<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Fixed Size"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: { gap: "sm"}) do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %> I'm 250px<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>3<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Flex"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: { gap: "sm"}) do %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {flex: "3"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {flex: "1"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props: {flex: "2"}) do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Order"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: { gap: "sm"}) do %> <%= pb_rails("flex/flex_item", props: {order: "4"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props: {order: "2"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props: {order: "1"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props: {order: "3"}) do %>4<% end %> <% end %> </div>
align_self | Type: String | Values: start | end | center | stretch
Align-self aligns the Flex Item on the cross axis. This prop may also be applied to the Flex kit and will act the same way.
<%= pb_rails("title", props: {size: 4, text: "Row"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item", props: {padding:"sm", align_self:"start"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"end"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item", props:{padding:"sm", align_self: "center"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex") do %> <%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"stretch"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>4<% end %> <% end %> </div> <br/><br/> <%= pb_rails("title", props: {size: 4, text: "Column"}) %> <br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column"}) do %> <%= pb_rails("flex/flex_item", props: {padding:"sm", align_self:"start"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column"}) do %> <%= pb_rails("flex/flex_item", props:{padding:"sm", align_self: "end"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column"}) do %> <%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"center"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div> <br/><br/> <div class="flex-doc-example"> <%= pb_rails("flex", props: {orientation: "column"}) do %> <%= pb_rails("flex/flex_item", props:{padding: "sm", align_self:"stretch"}) do %>1<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %> <%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %> <% end %> </div>
<%= pb_rails("layout", props: {position: "left", size: "sm", collapse: "md"}) do %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("body", props: { text: "Light" }) %> <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "sm", collapse: "md", variant: "dark"}) do %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("body", props: { text: "Dark", dark: true }) %> <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "sm", collapse: "md", variant: "gradient"}) do %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("body", props: { text: "Gradient", dark: true }) %> <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %>
<%= pb_rails("layout", props: {position: "left", size: "xs", collapse: "sm", transparent: true}) do %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("body", props: { text: "Side" }) %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("body", props: { text: "Body" }) %> <% end %> <% end %>
<%= pb_rails("layout", props: {position: "left", size: "xs", collapse: "xs"}) do %> <%= pb_rails("layout/sidebar") do %> Side <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "sm", collapse: "sm"}) do %> <%= pb_rails("layout/sidebar") do %> Side <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "md", collapse: "sm"}) do %> <%= pb_rails("layout/sidebar") do %> Side <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "lg", collapse: "sm"}) do %> <%= pb_rails("layout/sidebar") do %> Side <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %> <br/><br/> <%= pb_rails("layout", props: {position: "left", size: "xl", collapse: "sm"}) do %> <%= pb_rails("layout/sidebar") do %> Side <% end %> <%= pb_rails("layout/body") do %> Body <% end %> <% end %>
Layout can leverage the max-width property. Learn more in our visual guidelines.
<%= pb_rails("layout", props: {layout: "collection"}) do %> <%= pb_rails("layout/body") do %> <%= pb_rails("card" ) do %> Card content <% end %> <%= pb_rails("card") do %> <%= pb_rails("title", props: { text: "Title 4", tag: "h4", size: 4 }) %> <%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %> <% end %> <%= pb_rails("card" ) do %> <%= pb_rails("user", props: { name: "Anna Black", title: "Remodeling Consultant", orientation: "vertical", align: "center", size: "lg", avatar_url: "https://randomuser.me/api/portraits/women/44.jpg" }) %> <% end %> <%= pb_rails("card" ) do %> <%= pb_rails("title", props: { text: "Title 4", tag: "h4", size: 4 }) %> <%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %> <%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %> <% end %> <%= pb_rails("card" ) do %> Card content <% end %> <%= pb_rails("card") do %> Card content <% end %> <%= pb_rails("user", props: { name: "Anna Black", title: "Remodeling Consultant", orientation: "vertical", align: "center", size: "lg", avatar_url: "https://randomuser.me/api/portraits/women/44.jpg" }) %> <%= pb_rails("card" ) do %> Card content <% end %> <%= pb_rails("card" ) do %> <%= pb_rails("title", props: { text: "Title 4", tag: "h4", size: 4 }) %> <%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %> <%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %> <%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %> <% end %> <% end %> <% end %>
The left element on Collection Detail can be used for things such as navigation or secondary content to the element on the right. The right content can be used the same way that you would use Collection. The element on the right should be the primary focus and can be used for repeating elements such as cards.
<%= pb_rails("layout", props: {position: "left", size: "sm", collapse: "md", layout: "collection_detail" }) do %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("card", props: { margin_right: "md", padding: "none" }) do %> <%= pb_rails("nav", props: {title: "Menu", link: "#", padding_top:"md" }) 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 %> <% end %> <% end %> <%= pb_rails("layout/body") do %> <% 25.times do %> <%= pb_rails("card") do %> Card content <% end %> <% end %> <% end %> <% end %>
<%= pb_rails("layout", props: {layout: "kanban"}) do %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Queued'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'In Progress'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Validation'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Done'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'OKRs'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Bugs'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Another Column'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'Another Column'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("caption", props: {text: 'A Final Column'}) %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <%= pb_rails("card") do %> Kanban Item <% end %> <% end %> <% end %>
<%= pb_rails("layout", props: {layout: "content" }) do %> <%= pb_rails("layout/header") do %> <%= pb_rails("card") do %> Header <% end %> <% end %> <%= pb_rails("layout/sidebar") do %> <%= pb_rails("card") do %> Sidebar <br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. <% end %> <% end %> <%= pb_rails("layout/body") do %> <%= pb_rails("card") do %> Body <br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("layout/footer") do %> <%= pb_rails("card") do %> Footer <% end %> <% end %> <% end %>
<%= pb_rails("layout", props: {layout: "masonry"}) do %> <%= pb_rails("layout/body") do %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://unsplash.it/500/400/?image=634" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1611932084285-4fc50bfb7102?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxMnx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "md" }) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1611934529218-748707e1d066?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2307&q=80" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "md" }) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1611927263897-c2f1156bc760?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyMHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "lg"}) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1606851685679-2a35cfdd62d6?ixid=MXwxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwxMXx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "md" }) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1612144349227-1555ef8f2467?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzM3x8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://unsplash.it/500/400/?image=634" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1611932084285-4fc50bfb7102?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxMnx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "md" }) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1611934529218-748707e1d066?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2307&q=80" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://unsplash.it/500/400/?image=634" }) %> <% end %> <%= pb_rails("layout/item", props: { size: "md" }) do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1606851685679-2a35cfdd62d6?ixid=MXwxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwxMXx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1612123912968-5f6e964e8ea5?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0N3x8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://images.unsplash.com/photo-1612092172331-d788286028d5?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw3Mnx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" }) %> <% end %> <%= pb_rails("layout/item") do %> <%= pb_rails("image", props: { url: "https://unsplash.it/500/400/?image=634" }) %> <% end %> <% end %> <% end %>
Card can leverage the max-width property. Learn more in our visual guidelines.
Add a background color by passing the color name to background. List of all colors can be viewed here under Product Colors and Status: Subtle Variations.
<%= pb_rails("title", props: { text: "Card Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { background: "dark", dark: true, margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Dark", dark: true }) %> <% end %> <%= pb_rails("card", props: { margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "White / Default" }) %> <% end %> <%= pb_rails("card", props: { background: "light", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Light", dark: false }) %> <% end %> <%= pb_rails("title", props: { text: "Product Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { background: "product_1_background", dark: true, margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Product 1 Background", dark: true }) %> <% end %> <%= pb_rails("card", props: { background: "product_7_highlight", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Product 7 Highlight", dark: true }) %> <% end %> <%= pb_rails("card", props: { background: "product_2_background", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Product 2 Highlight", dark: true }) %> <% end %> <%= pb_rails("title", props: { text: "Subtle Status Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { background: "success_subtle", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Success Subtle" }) %> <% end %> <%= pb_rails("card", props: { background: "warning_subtle", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Warning Subtle" }) %> <% end %> <%= pb_rails("card", props: { background: "info_subtle", margin_bottom: "sm" }) do %> <%= pb_rails("body", props: { text: "Info Subtle" }) %> <% end %>
Card highlight can pass status, product, and category colors. List of all colors can be viewed here.
<%= pb_rails("card", props: {highlight: {position: "side", color:"product_6_highlight"}, margin_bottom: "sm"}) do %> Side Position & Product 6 Highlight Color <% end %> <%= pb_rails("card", props: {highlight: {position: "top", color:"warning"}, margin_bottom: "sm"}) do %> Top Position & Warning Color <% end %> <%= pb_rails("card", props: {highlight: {position: "right_side", color:"product_5_highlight"}, margin_bottom: "sm"}) do %> Right Side Position & Product 5 Highlight Color <% end %> <%= pb_rails("card", props: {highlight: {position: "side", color:"category_2"}, margin_bottom: "sm"}) do %> Side Position & Category 2 Color <% end %>
Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed here.
<%= pb_rails("title", props: { text: "Category Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm" }) do %> <%= pb_rails("body", props: { text: "Category 1", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Category 1 <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "category_3" }) do %> <%= pb_rails("body", props: { text: "Category 3", dark: false }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md", }) do %> Body <% end %> <% end %> <%= pb_rails("title", props: { text: "Product Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "product_2_background" }) do %> <%= pb_rails("body", props: { text: "Product 2 Background", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "product_6_background" }) do %> <%= pb_rails("body", props: { text: "Product 6 Background", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("title", props: { text: "Background Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "white" }) do %> <%= pb_rails("body", props: { text: "White", dark: false }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "dark" }) do %> <%= pb_rails("body", props: { text: "Dark", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("title", props: { text: "Striped Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "category_1", header_color_striped: true }) do %> <%= pb_rails("body", props: { text: "Striped Category 1", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md", }) do %> Body <% end %> <% end %> <%= pb_rails("title", props: { text: "Status Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "success" }) do %> <%= pb_rails("body", props: { text: "Success", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "error" }) do %> <%= pb_rails("body", props: { text: "Error", dark: true }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "success_subtle" }) do %> <%= pb_rails("body", props: { text: "Success Subtle" }) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %> <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %> <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "error_subtle" }) do %> <%= pb_rails("body", props: { text: "Error Subtle"}) %> <% end %> <%= pb_rails("card/card_body", props: { padding: "md" }) do %> Body <% end %> <% end %>
<%= pb_rails("card", props: { tag: "section" }) do %> section <% end %> <br /> <%= pb_rails("card", props: { tag: "footer" }) do %> footer <% end %> <br /> <%= pb_rails("card", props: { tag: "header" }) do %> header <% end %> <br /> <%= pb_rails("card", props: { tag: "article" }) do %> article <% end %> <br /> <%= pb_rails("card", props: { tag: "aside" }) do %> aside <% end %> <br /> <%= pb_rails("card", props: { tag: "main" }) do %> main <% end %> <br /> <%= pb_rails("card", props: { tag: "nav" }) do %> nav <% end %>
<%= pb_rails("card", props: {padding: "none"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {padding: "xs"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {padding: "md"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {padding: "lg"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {padding: "xl"}) do %> Card content <% end %>
<%= pb_rails("card", props: {shadow: "none"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {shadow: "deep"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {shadow: "deeper"}) do %> Card content <% end %> <br> <%= pb_rails("card", props: {shadow: "deepest"}) do %> Card content <% end %>
<%= pb_rails("card", props: { cursor: "pointer" }) do %> Card Content <% end %> <br> <%= pb_rails("card") do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %>
<%= pb_rails("card", props: { padding: "none" }) do %> <%= pb_rails("card/card_body", props: { padding: "sm" }) do %> Header <% end %> <%= pb_rails("section_separator") %> <%= pb_rails("card/card_body", props: { padding: "sm" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <%= pb_rails("section_separator") %> <%= pb_rails("card/card_body", props: { padding: "sm" }) do %> Footer <% end %> <% end %>
Remove card border only for dashboard cards.
border_radius_md is the card kit default
<%= pb_rails("card", props: { border_radius: "rounded" }) do %> Rounded (1000px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "xl" }) do %> Extra large (16px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "lg" }) do %> Large (8px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "md" }) do %> Medium (6px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "sm" }) do %> Small (4px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "xs" }) do %> Extra small (4px) <% end %> <br> <%= pb_rails("card", props: { border_radius: "none" }) do %> None <% end %>
To guarantee the vertical section separator displays properly, please add the vertical: "stretch"/vertical="stretch" property to the parent container (which is commonly a Flex container). This will stretch the container’s child elements vertically and ensure the section separator appears as expected.
<%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %> <%= pb_rails("body", props: {classname: "flex-item"}) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <% end %> <%= pb_rails("section_separator", props: { orientation: "vertical" }) %> <%= pb_rails("body", props: {classname: "flex-item"}) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <% end %> <%= pb_rails("section_separator", props: { orientation: "vertical" }) %> <%= pb_rails("body", props: {classname: "flex-item"}) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <% end %> <% end %>
Pass anything (including any of our kits) to the children prop to customize a separator's content.
NOTE: passing children overrides any content passed to text
<%= pb_rails("section_separator", props: { line_style: "dashed" }) do %> <%= pb_rails("card", props: { border_radius: "rounded", justify_content: "center", padding: "none" }) do %> <%= pb_rails("caption", props: { text: "TODAY", size: "xs", padding_left: "xs", padding_right: "xs" }) %> <% end %> <% end %> <%= pb_rails("flex", props: { classname: "flex-container", margin_top: "lg", vertical: "stretch" }) do %> <%= pb_rails("body", props: { classname: "flex-item" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <% end %> <%= pb_rails("section_separator", props: { orientation: "vertical" }) do %> <%= pb_rails("card", props: { border_radius: "rounded", justify_content: "center", padding: "none" }) do %> <%= pb_rails("caption", props: { text: "TODAY", size: "xs", padding_left: "xs", padding_right: "xs" }) %> <% end %> <% end %> <%= pb_rails("body", props: { classname: "flex-item" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <% end %> <% end %>
Pass "primary" to the color prop to change any section separator color.
NOTE: Passing children overrides any content provided via the text prop. The color prop does not affect the text prop's color, and the color of children is determined by the children's individual props. For greater control over text color customization, consider using a separator with children.
<%= pb_rails("section_separator", props: { text: "Default Separator" }) %> <%= pb_rails("section_separator", props: { color: "primary", text: "Primary Separator" }) %> <%= pb_rails("section_separator", props: { color: "primary", line_style: "dashed", text: "Primary Dashed Separator" }) %> <%= pb_rails("section_separator", props: { color: "primary" }) do %> <%= pb_rails("flex", props: { padding: "xs" }) do %> <%= pb_rails("icon", props: { color: "primary", icon: "arrow-down" }) %> <%= pb_rails("detail", props: { text: "Children", size: "sm", color: "link" }) %> <% end %> <% end %>
By default, the Background kit sets background color to 'light' as seen here.
To add a lazyload on the background image simply use the transition prop and one of the three string options "fade", "blur", or "scale".
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %> <%= pb_rails("flex", props: { horizontal: "center", orientation: "column", margin_bottom: "xl" }) do %> <%= pb_rails("flex/flex_item") do %> <%= pb_rails("title", props: { dark: true, size: 1, text: "Background Kit Image" })%> <% end %> <%= pb_rails("flex/flex_item", props: { padding: "lg" }) do %> <%= pb_rails("card", props: { shadow: "deepest" }) do %> We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. -Cesar Chavez <% end %> <% end %> <% end %> <% end %> <%= pb_rails("flex", props: { margin_top: "lg" }) do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %> <%= pb_rails("select", props: { id: "transition-dropdown", label: "", blank_selection: "Select a Transition...", options: [ { value: 'fade', }, { value: 'blur', }, { value: 'scale', }, ] }) %> <% end %> <% end %> <script> window.addEventListener('DOMContentLoaded', () => { const transitionDropdown = document.querySelector("#transition-dropdown") var option = '' transitionDropdown.addEventListener('change', function() { if (this.value === '') { (transitionDropdown).className = (transitionDropdown).className + ' _disabled' } else { (transitionDropdown).removeAttribute("disabled"); (transitionDropdown).className = (transitionDropdown) option = this.value } }); const updateTransition = (transition) => { const imageTransition = document.querySelector('.background-image') imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded") imageTransition.classList.add(transition, "lazyload") } (transitionDropdown).addEventListener('change', function() { updateTransition(option) }) }); </script>
Status colors can be passed into the background kit. success, success_secondary, warning, warning_secondary, error, error_secondary, info, info_secondary, neutral, neutral_secondary, primary, and primary_secondary
<%= pb_rails("flex", props: {gap: "md", justify: "center", wrap: true}) do %> <%= pb_rails("background", props: { background_color: "success", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "success_secondary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "warning", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "warning_secondary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "error", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "error_secondary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "info", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "info_secondary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "neutral", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "neutral_secondary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "primary", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "primary_secondary", padding: "xl" }) do %> <% end %> <%end%>
Status Subtle colors can be passed into the background kit. success_subtle, warning_subtle,error_subtle, info_subtle and neutral_subtle
<%= pb_rails("flex", props: {gap: "md", justify: "center", wrap: true}) do %> <%= pb_rails("background", props: { background_color: "success_subtle", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "warning_subtle", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "error_subtle", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "info_subtle", padding: "xl" }) do %> <% end %> <br> <%= pb_rails("background", props: { background_color: "neutral_subtle", padding: "xl" }) do %> <% end %> <%end%>
Category colors can be passed into the background kit. Values category_1 to category_21 are accepted. List of all category and status colors can be viewed here.
<%= pb_rails("flex", props: {gap: "md", justify: "center", wrap: true}) do %> <%= pb_rails("background", props: { background_color: "category_1", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_2", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_3", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_4", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_5", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_6", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_7", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_8", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_9", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_10", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_11", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_12", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_13", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_14", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_15", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_16", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_17", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_18", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_19", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_20", padding: "xl" }) do %> <% end %> <%= pb_rails("background", props: { background_color: "category_21", padding: "xl" }) do %> <% end %> <%end%>
Background size can be passed into the background kit. Values auto, cover, and contain are accepted.
💡 Note: When using contain you might not want to have a repeating background as this will not always look pleasant. To prevent this, you may pass no-repeat to the backgroundRepeat prop.
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "auto", padding: "xl" }) %> <br/> <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "cover", padding: "xl" }) %> <br/> <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_repeat: "no-repeat", background_size: "contain", padding: "xl" }) %>
<%= pb_rails("collapsible", props: { name: "default-example" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main"}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %>
This kit uses icon sizes. If you don't give it a size, it will default to medium. This can be replaced with the sizes below:
lg xs sm 1x 2x 3x 4x 5x 6x 7x 8x 9x 10x<%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", size: "xs" }) do %> <%= pb_rails("body", props: { text: "Extra Small Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", size: "sm" }) do %> <%= pb_rails("body", props: { text: "Small Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main" }) do %> <%= pb_rails("body", props: { text: "Medium Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", size: "lg" }) do %> <%= pb_rails("body", props: { text: "Large Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %>
This kit uses default color by default, and can be replaced with colors below:
light lighter success error link<%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "default"}) do %> <%= pb_rails("body", props: { text: "Default Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "light"}) do %> <%= pb_rails("body", props: { text: "Light Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "lighter"}) do %> <%= pb_rails("body", props: { text: "Lighter Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "link"}) do %> <%= pb_rails("body", props: { text: "Link Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "error"}) do %> <%= pb_rails("body", props: { text: "Error Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example", margin_bottom: "xs" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main", color: "success"}) do %> <%= pb_rails("body", props: { text: "Success Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %>
The icon prop allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when collapsed (chevron-down), and the second value will replace the default icon when expanded (chevron-up). icon also allows you to pass it a single icon as a string, in which case the icon will not toggle with the collapsible state.
<%= pb_rails("collapsible", props: { name: "custom-icons-example" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "custom-icons-main", icon: ["plus", "minus"]}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %>
The collapsed prop (boolean; default = true) handles the collapsed state of a collapsible. Set it to 'false' and the collapsible will render in an expanded state on page load.
You can also control the collapsed state using an external control (like a button). To do this, you must first apply a unique id to the collapsible/collapsible_content child element. You can then attach an eventListner to the external control of your choice, pass it the id as an argument and use document.dispatchEvent(new CustomEvent(id)) to trigger the action. See the code example below for details.
<div onclick="toggleCollapsibleById('collapsed-toggle')"> <%= pb_rails("button", props: { text: "Toggle Collapsible", variant:"link"}) %> </div> <%= pb_rails("collapsible", props: { name: "default-example" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "default-main"}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md", collapsed: false, id:"collapsed-toggle" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <script> const toggleCollapsibleById = (id) => { document.dispatchEvent(new CustomEvent(id)); }; </script>
The external control functionality can also be used to toggle multiple collapsibles with the same control. See the code example below to see this in action.
<%= pb_rails("button", props: { variant:"link", text: "Toggle All", id: "toggle-button-example"}) %> <%= pb_rails("collapsible", props: { name: "default-example" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "xs", name: "default-main"}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md", id:"collapse-toggle-1" }) do %> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example-2" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "xs", name: "default-main"}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md", id:"collapse-toggle-2" }) do %> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <%= pb_rails("collapsible", props: { name: "default-example-3" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "xs", name: "default-main"}) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md", id:"collapse-toggle-3" }) do %> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% end %> <% end %> <script> window.addEventListener('DOMContentLoaded', () => { const collapsibles = document.querySelectorAll('[id^="collapse-toggle"]'); const button = document.querySelector("#toggle-button-example"); button.addEventListener("click", () => { collapsibles.forEach(collapsible => { document.dispatchEvent(new CustomEvent(collapsible.id)); }) }) }) </script>
Optionally replace your collapsible/collapsible_main with any component to customize your Main section's contents and/or style. This gives you full control over that subcomponent. For example, here we are using global props to make that custom Main 'sticky' on scroll.
NOTE: Custom main sections require data: {"collapsible-main": "true"} to ensure the collapsible's toggle action works correctly.
<%= pb_rails("collapsible", props: { name: "default-example" }) do %> <%= pb_rails("flex", props: { position: "sticky", top: "0", cursor: "pointer", data: { "collapsible-main": "true", align: "center", gap: "sm", justify: "between" } }) do %> <%= pb_rails("flex", props: {align:"center", gap:"sm", justify:"between"}) do %> <%= pb_rails("title", props: { text: "Custom Main Section", tag: "h4", size: 4 }) %> <% end %> <% end %> <%= pb_rails("flex", props: { align: "center", justify: "between" }) do %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "none" }) do %> <%= pb_rails("list", props: {ordered: false, dark: false, borderless: false}) do %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <% end %> <% end %> <% end %>
When using a custom Main Section, you can also use the optional collapsible/collapsible_icon subcomponent.
NOTE: The optional icon subcomponent accepts all icon-related props (icon, size, and color) for further customization. If none of these are specified, the default icon will be rendered.
<%= pb_rails("collapsible", props: { name: "default-example" }) do %> <%= pb_rails("flex", props: { position: "sticky", top: "0", cursor: "pointer", data: { "collapsible-main": "true" }, align: "center", gap: "sm", justify: "between" }) do %> <%= pb_rails("title", props: { text: "Custom Main Section", tag: "h4", size: 4 }) %> <%= pb_rails("collapsible/collapsible_icon") %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "none" }) do %> <%= pb_rails("list", props: {ordered: false, dark: false, borderless: false}) do %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <%= pb_rails("list/item") do %> Checklist Item <% end %> <% end %> <% end %> <% end %>
<%= pb_rails("collapsible", props: { name: "no-icon-example" }) do %> <%= pb_rails("collapsible/collapsible_main", props: { padding: "md", name: "no-icon-main", icon: "none" }) do %> <%= pb_rails("body", props: { text: "Main Section"}) %> <% end %> <%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at. <br><br> Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa. <% 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 |
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 %>
The draggable kit gives you a full subcomponent structure that allows it to be used with almost any kit.
initial_items is a REQUIRED prop, which is the array of objects that contains data for the the draggable items.
draggable/draggable_container = This specifies the container within which items can be dropped.
draggable/draggable_item = This specifies the items that can be dragged and dropped. drag_id is a REQUIRED prop for draggable_item and must match the id on the items within initial_items.
<% initial_items = [ { id: "1", url: "https://unsplash.it/500/400/?image=633", }, { id: "2", url: "https://unsplash.it/500/400/?image=634", }, { id: "3", url: "https://unsplash.it/500/400/?image=637", }, ] %> <%= pb_rails("draggable", props: {initial_items: initial_items}) do %> <%= pb_rails("draggable/draggable_container") do %> <%= pb_rails("flex") do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %> <% end %> <% end %> <% end %> <% end %> <% end %>
For a simplified version of the Draggable API for the List kit, you can do the following:
The List kit is optimized to work with the draggable kit. To enable drag, use the enable_drag prop on List kit with an array of the included items AND drag_id prop on ListItems. You will also need to include the items prop containing your array of listed items for the Draggable API.
An additional optional boolean prop (set to true by default) of drag_handle is also available on ListItem kit to show the drag handle icon.
<% initial_items = [ { id: "31", name: "Philadelphia" }, { id: "32", name: "New Jersey" }, { id: "33", name: "Maryland" }, { id: "34", name: "Connecticut" }, ] %> <%= pb_rails("list", props: { enable_drag: true, items: initial_items }) do %> <% initial_items.each do |item| %> <%= pb_rails("list/item", props:{drag_id: item[:id]}) do %><%= item[:name] %><% end %> <% end %> <% end %>
For a simplified version of the Draggable API for the SelectableList kit, you can do the following:
The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the enable_drag prop on SelectableList kit AND drag_id prop within the SelectableList kit prop. An additional optional boolean prop (set to true by default) of drag_handle is also available on SelectableList kit to show the drag handle icon.
<%= pb_rails("selectable_list", props: { enable_drag: true, variant: "radio", items: [ { drag_id: "41", text: "Task 1", input_options: { value: "1", name: "radio-name", } }, { drag_id: "42", text: "Task 2", checked: true, input_options: { value: "2", name: "radio-name", } }, { drag_id: "43", text: "Task 3", input_options: { value: "3", name: "radio-name", } }, { drag_id: "44", text: "Task 4", input_options: { value: "4", name: "radio-name", } } ] } ) %>
For a simplified version of the Draggable API for the Card kit, you can do the following:
Use the draggable kit and manage state as shown.
draggable/draggable_container kit creates the container within which the cards can be dragged and dropped.
The Card kit is optimized to work with the draggable kit. To enable drag, use the draggable_item and drag_id props on the Card kit as shown. An additional optional boolean prop (set to true by default) of drag_handle is also available to show the drag handle icon.
<% initial_items = [ { id: "21", name: "Joe Black" }, { id: "22", name: "Nancy White" }, { id: "23", name: "Bill Green" }, ] %> <%= pb_rails("draggable", props: {initial_items: initial_items}) do %> <%= pb_rails("draggable/draggable_container") do %> <% initial_items.each do |item| %> <%= pb_rails("card", props: {highlight: {position: "side", color:"primary"}, margin_bottom: "xs", padding: "xs", drag_id: item[:id], draggable_item: true }) do %> <%= pb_rails("flex", props:{align_items: "stretch", flex_direction:"column"}) do %> <%= pb_rails("flex", props:{gap: "xs"}) do %> <%= pb_rails("title", props: { text: item[:name], tag: "h4", size: 4 }) %> <%= pb_rails("badge", props: {text:"35-12345" ,variant: "primary"}) %> <% end %> <%= pb_rails("caption", props: { size: "xs", text: "8:00A • Township Name • 90210" }) %> <%= pb_rails("flex", props:{gap: "xxs", spacing:"between"}) do %> <%= pb_rails("flex", props:{gap: "xxs"}) do %> <%= pb_rails("caption", props: { size: "xs" , color: "error" }) do %> <%= pb_rails("icon", props: { icon: "house-circle-exclamation", fixed_width: true }) %> <% end %> <%= pb_rails("caption", props: { size: "xs" , color: "success" }) do %> <%= pb_rails("icon", props: { icon: "file-circle-check", fixed_width: true }) %> <% end %> <% end %> <%= pb_rails("flex") do %> <%= pb_rails("badge", props: {text:"Schedule QA" ,variant: "warning", rounded: true}) %> <%= pb_rails("badge", props: {text:"Flex" ,variant: "primary", rounded: true}) %> <%= pb_rails("badge", props: {text:"R99" ,variant: "primary", rounded: true}) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %>
| id | name | task number |
|---|---|---|
| 1 |
Terry Miles
| Task 1 |
| 2 |
Sophia Miles
| Task 2 |
| 3 |
Alice Jones
| Task 3 |
| 4 |
Mike James
| Task 4 |
| 5 |
James Guy
| Task 5 |
The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this:
draggable_container prop on the table/table_body to designate it as the Draggable Containerdraggable_item prop on the table/table_row to designate it as the Draggable Item. Make sure to also pass id to the drag_id prop here. <% initial_items = [ { id: "1", title: "Task 1", assignee_name: "Terry Miles", assignee_img: "https://randomuser.me/api/portraits/men/44.jpg", }, { id: "2", title: "Task 2", assignee_name: "Sophia Miles", assignee_img: "https://randomuser.me/api/portraits/women/8.jpg", }, { id: "3", title: "Task 3", assignee_name: "Alice Jones", assignee_img: "https://randomuser.me/api/portraits/women/10.jpg", }, { id: "4", title: "Task 4", assignee_name: "Mike James", assignee_img: "https://randomuser.me/api/portraits/men/8.jpg", }, { id: "5", title: "Task 5", assignee_name: "James Guy", assignee_img: "https://randomuser.me/api/portraits/men/18.jpg", } ] %> <%= pb_rails("draggable", props: {initial_items: initial_items}) do %> <%= pb_rails("table", props: { size: "sm", responsive:"none" }) do %> <%= pb_rails("table/table_head") do %> <%= pb_rails("table/table_row") do %> <%= pb_rails("table/table_header", props: { text: "id"}) %> <%= pb_rails("table/table_header", props: { text: "name"}) %> <%= pb_rails("table/table_header", props: { text: "task number"}) %> <% end %> <% end %> <%= pb_rails("table/table_body", props: {draggable_container: true}) do %> <% initial_items.each do |item| %> <%= pb_rails("table/table_row", props:{drag_id: item[:id], draggable_item: true}) do %> <%= pb_rails("table/table_cell", props: { text: item[:id]}) %> <%= pb_rails("table/table_cell") do %> <%= pb_rails("flex", props:{align:"center"}) do %> <%= pb_rails("avatar", props: {size: "xs", image_url: item[:assignee_img]}) %> <%= pb_rails("body", props: {text: item[:assignee_name], padding_left:"sm"}) %> <% end %> <% end %> <%= pb_rails("table/table_cell", props: { text: item[:title]}) %> <% end %> <% end %> <% end %> <% end %> <% end %>
The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
When using the "line" type, make sure to set the appropriate direction attribute on the draggable/draggable_container component based on the orientation of your draggable view: "vertical" or "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the Draggable Drop Zones Line doc example.
<% data_shadow = [ { id: "51", text: "Task 1" }, { id: "52", text: "Task 2" }, { id: "53", text: "Task 3" } ] %> <% data_outline = [ { id: "61", text: "Task 1" }, { id: "62", text: "Task 2" }, { id: "63", text: "Task 3" } ] %> <% data_line = [ { id: "71", text: "Task 1" }, { id: "72", text: "Task 2" }, { id: "73", text: "Task 3" } ] %> <%= pb_rails("flex", props: { justify: "between" }) do %> <%= pb_rails("flex/flex_item", props: { margin_right: "xl" }) do %> <%= pb_rails("draggable", props: { drop_zone_type: "shadow", initial_items: data_shadow }) do %> <%= pb_rails("caption", props: { margin_bottom: "xs", text: "Shadow", text_align: "center" }) %> <%= pb_rails("draggable/draggable_container", props: { html_options: { style: { width: "200px" } } }) do %> <% data_shadow.each do |item| %> <%= pb_rails("card", props: { drag_id: item[:id], draggable_item: true, margin_bottom: "xs", padding: "xs", padding_right: "xl" }) do %> <%= pb_rails("flex", props: { align_items: "stretch", flex_direction: "column" }) do %> <%= pb_rails("body", props: { text: item[:text] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <%= pb_rails("flex/flex_item", props: { margin_right: "xl" }) do %> <%= pb_rails("draggable", props: { drop_zone_type: "outline", initial_items: data_outline }) do %> <%= pb_rails("caption", props: { margin_bottom: "xs", text: "Outline", text_align: "center" }) %> <%= pb_rails("draggable/draggable_container", props: { html_options: { style: { width: "200px" } } }) do %> <% data_outline.each do |item| %> <%= pb_rails("card", props: { drag_id: item[:id], draggable_item: true, margin_bottom: "xs", padding: "xs", padding_right: "xl" }) do %> <%= pb_rails("flex", props: { align_items: "stretch", flex_direction: "column" }) do %> <%= pb_rails("body", props: { text: item[:text] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <%= pb_rails("flex/flex_item", props: { margin_right: "xl" }) do %> <%= pb_rails("draggable", props: { drop_zone_type: "line", initial_items: data_line }) do %> <%= pb_rails("caption", props: { margin_bottom: "xs", text: "Line", text_align: "center" }) %> <%= pb_rails("draggable/draggable_container", props: { drop_zone_direction: "vertical", html_options: { style: { width: "200px" } } }) do %> <% data_line.each do |item| %> <%= pb_rails("card", props: { drag_id: item[:id], draggable_item: true, margin_bottom: "xs", padding: "xs", padding_right: "xl", drop_zone_line_color: "primary" }) do %> <%= pb_rails("flex", props: { align_items: "stretch", flex_direction: "column" }) do %> <%= pb_rails("body", props: { text: item[:text] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %>
The default color for Draggable kit drop zones is "neutral", with "primary" or "purple" as additional options.
<% initial_items = [ { id: "141", url: "https://unsplash.it/500/400/?image=633", }, { id: "142", url: "https://unsplash.it/500/400/?image=634", }, { id: "143", url: "https://unsplash.it/500/400/?image=637", }, ] %> <% next_init_items = [ { id: "151", url: "https://unsplash.it/500/400/?image=633", }, { id: "152", url: "https://unsplash.it/500/400/?image=634", }, { id: "153", url: "https://unsplash.it/500/400/?image=637", }, ] %> <%= pb_rails("draggable", props: {initial_items: initial_items, drop_zone_type: "shadow", drop_zone_color: "primary"}) do %> <%= pb_rails("draggable/draggable_container") do %> <%= pb_rails("flex", props: { gap: "sm" }) do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <br/> <%= pb_rails("draggable", props: {initial_items: next_init_items, drop_zone_type: "outline", drop_zone_color: "purple"}) do %> <%= pb_rails("draggable/draggable_container") do %> <%= pb_rails("flex", props: { gap: "sm" }) do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url] }) %> <% end %> <% end %> <% end %> <% end %> <% end %>
When using the "line" style, make sure to set the appropriate direction attribute within the drop_zone_direction prop on the draggable/draggable_container component based on the orientation of your draggable view: "vertical" or "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. Also, set the drop_zone_line_color prop on the draggable/draggable_item component to "primary" or "purple".
The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
Additionally, if the parent container of the draggable/draggable/draggable_container (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the Draggable Drop Zones doc example does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
<% initial_items = [ { id: "211", url: "https://unsplash.it/500/400/?image=633", }, { id: "212", url: "https://unsplash.it/500/400/?image=634", }, { id: "213", url: "https://unsplash.it/500/400/?image=637", }, ] %> <% next_init_items = [ { id: "2111", url: "https://unsplash.it/500/400/?image=633", }, { id: "2112", url: "https://unsplash.it/500/400/?image=634", }, { id: "2113", url: "https://unsplash.it/500/400/?image=637", }, ] %> <%= pb_rails("draggable", props: {initial_items: initial_items, drop_zone_type: "line"}) do %> <%= pb_rails("draggable/draggable_container", props: { drop_zone_direction: "vertical" }) do %> <%= pb_rails("flex", props: { gap: "sm", orientation: "column", height: "367px" }) do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id], drop_zone_line_color: "purple"}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <br/> <%= pb_rails("draggable", props: {initial_items: next_init_items, drop_zone_type: "line"}) do %> <%= pb_rails("draggable/draggable_container", props: { drop_zone_direction: "horizontal" }) do %> <%= pb_rails("flex", props: { gap: "sm", html_options: { style: "width: 332px;" } }) do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id], drop_zone_line_color: "primary"}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url] }) %> <% end %> <% end %> <% end %> <% end %> <% end %>
You can add drag event listeners for drag, dragend, dragenter, dragleave, dragover, dragstart, and drop.
<% initial_items = [ { id: "100", url: "https://unsplash.it/500/400/?image=638", }, { id: "200", url: "https://unsplash.it/500/400/?image=639", }, { id: "300", url: "https://unsplash.it/500/400/?image=640", }, ] %> <%= pb_rails("draggable", props: {initial_items: initial_items}) do %> <%= pb_rails("draggable/draggable_container") do %> <%= pb_rails("flex") do %> <% initial_items.each do |item| %> <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %> <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <script> const itemIds = ["item_100", "item_200", "item_300"]; itemIds.forEach((id) => { const element = document.getElementById(id); if (element) { element.addEventListener("dragstart", (event) => { console.log(`${id} drag start!`); }); element.addEventListener("dragend", (event) => { console.log(`${id} drag end!`); }); } }); </script>
The Draggable kit can also be used to achieve more complex, multiple container functionality as shown here. This complex usage requires the full subcomponent structure.
<% containers = [ "To Do", "In Progress", "Done" ] %> <% items_data = [ { id: "11", container: "To Do", title: "Task 1", description: "Bug fixes", assignee_name: "Terry Miles", assignee_img: "https://randomuser.me/api/portraits/men/44.jpg", }, { id: "12", container: "To Do", title: "Task 2", description: "Documentation", assignee_name: "Sophia Miles", assignee_img: "https://randomuser.me/api/portraits/women/8.jpg", }, { id: "13", container: "In Progress", title: "Task 3", description: "Add a variant", assignee_name: "Alice Jones", assignee_img: "https://randomuser.me/api/portraits/women/10.jpg", }, { id: "14", container: "To Do", title: "Task 4", description: "Add jest tests", assignee_name: "Mike James", assignee_img: "https://randomuser.me/api/portraits/men/8.jpg", }, { id: "15", container: "Done", title: "Task 5", description: "Alpha testing", assignee_name: "James Guy", assignee_img: "https://randomuser.me/api/portraits/men/18.jpg", }, { id: "16", container: "In Progress", title: "Task 6", description: "Release", assignee_name: "Sally Jones", assignee_img: "https://randomuser.me/api/portraits/women/28.jpg", }, ] %> <%= pb_rails("draggable", props: { initial_items: items_data }) do %> <%= pb_rails("flex", props: { justify_content: "center" }) do %> <% containers.each do |container| %> <%= pb_rails("draggable/draggable_container", props: { container: container, width: "xs", padding: "sm", data: { container: container } }) do %> <%= pb_rails("caption", props: { text_align: "center" }) do %><%= container %><% end %> <%= pb_rails("flex", props: {align_items: "stretch", orientation: "column"}) do %> <% items_data.select { |item| item[:container] == container }.each do |item| %> <%= pb_rails("draggable/draggable_item", props: { container: container, drag_id: item[:id] }) do %> <%= pb_rails("card", props: { margin_bottom: "sm", padding: "sm"}) do %> <%= pb_rails("flex", props: { justify: "between" }) do %> <%= pb_rails("flex/flex_item") do %> <%= pb_rails("flex") do %> <%= pb_rails("avatar", props: { image_url: item[:assignee_img], name: item[:assignee_name], size: "xxs" }) %> <%= pb_rails("title", props: { padding_left: "xs", size: 4, text: item[:title] }) %> <% end %> <% end %> <% end %> <%= pb_rails("body", props: { padding_top: "xs", text: item[:description] }) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %>