Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

set default padding to 3

Behrokh Satarnejad83fdf0192882
diff --git a/app/components/op_primer/inset_box_component.html.erb b/app/components/op_primer/inset_box_component.html.erb
index 34782cf798c..9c7bd227299 100644
--- a/app/components/op_primer/inset_box_component.html.erb
+++ b/app/components/op_primer/inset_box_component.html.erb
@@ -28,19 +28,13 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%=
- args = system_arguments.dup
-
- # Only set default padding if no padding keys are given
- unless args.key?(:p) || args.key?(:pt) || args.key?(:pb) || args.key?(:pl) || args.key?(:pr)
- args[:p] = 3
- end
-
render(
Primer::Box.new(
border:,
border_radius: 2,
bg: :inset,
- **args
+ p: 3,
+ **system_arguments
)
) do
content
diff --git a/lookbook/docs/components/inset-box.md.erb b/lookbook/docs/components/inset-box.md.erb
index e6aa70657e0..4e767d4c65d 100644
--- a/lookbook/docs/components/inset-box.md.erb
+++ b/lookbook/docs/components/inset-box.md.erb
@@ -15,6 +15,7 @@ The Inset Box is made up of:
- **Border:** enabled by default
- **Border radius:** 2
- **Background:** `:inset` (light grey)
+- **Padding:** 3
<%= embed OpPrimer::InsetBoxComponentPreview, :default %>
@@ -23,6 +24,7 @@ The Inset Box is made up of:
The Inset Box supports the following options:
- **Border** – can be disabled with `border: false`.
+- **Padding** – defaults to `p: 3`.
- **Background** – defaults to `:inset`, but can be set to `:muted` or other Primer colors.
- **Other system arguments** – all `Primer::Box` arguments are passed through.
@@ -38,6 +40,8 @@ Some places where we already use the Inset Box:
It is useful whenever content should stand out from the page background while staying lightweight.
+If content needs more structure (e.g., with headers, actions, or multiple items), consider using the [Border Box](./border_box) component instead.
+
## Best practices
**Do**
@@ -55,4 +59,4 @@ It is useful whenever content should stand out from the page background while st
<%= embed OpPrimer::InsetBoxComponentPreview, :default %>
-The Inset Box is implemented as a wrapper around `Primer::Box` with opinionated defaults for border, border radius, and background. It passes through all other `system_arguments` to `Primer::Box`.
+The Inset Box is implemented as a wrapper around `Primer::Box` with opinionated defaults for border, padding, border radius, and background. It passes through all other `system_arguments` to `Primer::Box`.