Box

Samples

Basic

1.5ms 931 allocs

Title

Description

Lorem ipsum dolor sit amet…
View Source
<%= render "shared/box" do |box| %>
  <% box.title "Title" %>
  <% box.description "Description" %>
  <% box.body "Lorem ipsum dolor sit amet…" %>
<% end %>

With Divider

1.0ms 813 allocs

Title

Description

Lorem ipsum dolor sit amet…
View Source
<%= render "shared/box", divider: true do |box| %>
  <% box.title "Title" %>
  <% box.description "Description" %>
  <% box.body "Lorem ipsum dolor sit amet…" %>
<% end %>

With top border

2.4ms 814 allocs

Title

View Source
<%= render "shared/box", title: "Title", border_top: true %>

Without background

1.7ms 811 allocs

Title

View Source
<%= render "shared/box", title: "Title", no_background: true %>

Options

Name Required Type Default Description
title
Content Block
title_size
String
A CSS string to control title size
title_padding
String
A CSS string to control title padding
description
Content Block
Content text to render beneath the title
table
Content Block
body
Content Block
The main content body of the element
footer
Content Block
Add a footer at the bottom within the container, with a top border and some padding
raw_footer
Content Block
Add a footer without a top border and padding
actions
Content Block
Content designated to contain actions, like buttons, beneath the body
pagy
Pagy object
Pass in a pagy to render a pagy_nav below the body
divider
Boolean
false
Whether to add dividers between sections
border_top
Boolean
false
Whether to add a top border to the container element
no_background
Boolean
false
Pass true to remove the surrounding background on the container