x
1
2
3
4
5
6
7
<div data-view-component="true" class="Box"> <div id="header-90e8a484-e221-4081-80e6-accd66a93a4e" data-view-component="true" class="Box-header"> <h2 data-view-component="true" class="Box-title">Header with title</h2> </div> <div data-view-component="true" class="Box-body">Body</div> <div data-view-component="true" class="Box-footer">Footer</div></div>
1
2
3
4
5
6
7
8
9
render(Primer::Beta::BorderBox.new) do |component| component.with_header do |header| header.with_title(tag: :h2) do "Header with title" end end component.with_body { "Body" } component.with_footer { "Footer" }end
No notes provided.
No params configured.
app/components/primer/beta/border_box.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/* stylelint-disable primer/spacing *//* stylelint-disable primer/typography *//* BorderBox *//* TODO: Rename to BorderBox to match PVC */.Box { background-color: var(--bgColor-default); border-color: var(--borderColor-default); border-style: solid; border-width: var(--borderWidth-thin); border-radius: var(--borderRadius-medium);}/* Box padding density options */.Box--condensed { line-height: 1.25;}.Box--condensed .Box-header { padding: var(--stack-padding-condensed) var(--stack-padding-normal); }.Box--condensed .Box-body { padding: var(--stack-padding-condensed) var(--stack-padding-normal); }.Box--condensed .Box-footer { padding: var(--stack-padding-condensed) var(--stack-padding-normal); }.btn-octicon:is(.Box--condensed .Box-btn-octicon) { padding: var(--control-medium-paddingInline-condensed) var(--control-medium-paddingInline-spacious); margin: calc(var(--controlStack-medium-gap-condensed) * -1) calc(var(--controlStack-small-gap-spacious) * -1); line-height: 1.25; }.Box--condensed .Box-row { padding: var(--stack-padding-condensed) var(--stack-padding-normal); }.Box--spacious .Box-header { padding: var(--stack-padding-spacious); line-height: 1.25; }.Box--spacious .Box-title { font-size: var(--text-title-size-medium); }.Box--spacious .Box-body { padding: var(--stack-padding-spacious); }.Box--spacious .Box-footer { padding: var(--stack-padding-spacious); }.btn-octicon:is(.Box--spacious .Box-btn-octicon) { padding: var(--stack-padding-spacious); margin: calc(var(--stack-gap-spacious) * -1); }.Box--spacious .Box-row { padding: var(--stack-padding-spacious); }.Box-header { padding: var(--stack-padding-normal); margin: calc(var(--borderWidth-thin) * -1) calc(var(--borderWidth-thin) * -1) 0; background-color: var(--bgColor-muted); border-color: var(--borderColor-default); border-style: solid; border-width: var(--borderWidth-thin); border-top-left-radius: var(--borderRadius-medium); border-top-right-radius: var(--borderRadius-medium);}.Box-title { font-size: var(--text-body-size-medium); font-weight: var(--base-text-weight-semibold);}.Box-body { padding: var(--stack-padding-normal); border-bottom: var(--borderWidth-thin) solid var(--borderColor-default); /* Ensures bottom-border doesn't poke out when .Box-body used without box-footer */}.Box-body:last-of-type { margin-bottom: calc(var(--borderWidth-thin) * -1); border-bottom-right-radius: var(--borderRadius-medium); border-bottom-left-radius: var(--borderRadius-medium); }/* Box rows */.Box-row { padding: var(--stack-padding-normal); margin-top: calc(var(--borderWidth-thin) * -1); list-style-type: none; /* To account for applying Box component to a list */ border-top-color: var(--borderColor-muted); border-top-style: solid; border-top-width: var(--borderWidth-thin);}.Box-row:first-of-type { border-top-left-radius: var(--borderRadius-medium); border-top-right-radius: var(--borderRadius-medium); }.Box-row:last-of-type { border-bottom-right-radius: var(--borderRadius-medium); border-bottom-left-radius: var(--borderRadius-medium); }/* Adds a blue vertical line to the left of the row ** For indicating a row item is unread */.Box-row.Box-row--unread,.Box-row.unread { /* stylelint-disable-next-line primer/box-shadow */ box-shadow: inset 2px 0 0 var(--borderColor-accent-emphasis); }/* Focus styles for when drag icon */.Box-row.navigation-focus .Box-row--drag-button { color: var(--fgColor-accent); cursor: grab; opacity: 100; }/* Grabbing while row is dragged */.Box-row.navigation-focus.is-dragging .Box-row--drag-button { cursor: grabbing; }/* Row dragging styles */.Box-row.navigation-focus.sortable-chosen { background-color: var(--bgColor-muted); }/* Makes dragging row background gray */.Box-row.navigation-focus.sortable-ghost { background-color: var(--bgColor-muted); /* Hides contents of row while dragging so row looks solid gray */ }.Box-row.navigation-focus.sortable-ghost .Box-row--drag-hide { opacity: 0; }.Box-row--focus-gray.navigation-focus { background-color: var(--bgColor-muted); }.Box-row--focus-blue.navigation-focus { background-color: var(--bgColor-accent-muted); }.Box-row--hover-gray:hover { background-color: var(--bgColor-muted); }.Box-row--hover-blue:hover { background-color: var(--bgColor-accent-muted); }/* Optional link style** Makes links on mobile blue since they don't have hover state,** and links are dark-gray with blue hover on desktop. */@media (min-width: 768px) {.Box-row-link { color: var(--fgColor-default); -webkit-text-decoration: none; text-decoration: none;} .Box-row-link:hover { color: var(--fgColor-accent); -webkit-text-decoration: none; text-decoration: none; } }/* Optional drag icon styles for reordering items** Focus styles included in .Box-row above */.Box-row--drag-button { opacity: 0;}.Box-footer { padding: var(--stack-padding-normal); margin-top: calc(var(--borderWidth-thin) * -1); /* prevents double border when used with .Box-body */ border-top-color: var(--borderColor-default); border-top-style: solid; border-top-width: var(--borderWidth-thin); border-radius: 0 0 var(--borderRadius-medium) var(--borderRadius-medium);}/* Option for a box with scrolling content */.Box--scrollable { max-height: 324px; overflow: scroll;}/* Box themes */.Box--blue { border-color: var(--borderColor-accent-muted);}.Box--blue .Box-header { background-color: var(--bgColor-accent-muted); border-color: var(--borderColor-accent-muted); }.Box--blue .Box-body { border-color: var(--borderColor-accent-muted); }.Box--blue .Box-row { border-color: var(--borderColor-accent-muted); }.Box--blue .Box-footer { border-color: var(--borderColor-accent-muted); }/* Applies and red border to the outside of the box,** but not to the border separating rows. */.Box--danger { border-color: var(--borderColor-danger-emphasis);}:is(.Box--danger .Box-row):first-of-type { border-color: var(--borderColor-danger-emphasis); }:is(.Box--danger .Box-body):last-of-type { border-color: var(--borderColor-danger-emphasis); }.Box-header--blue { background-color: var(--bgColor-accent-muted); border-color: var(--borderColor-accent-muted);}/* Box row highlight themes */.Box-row--yellow { background-color: var(--bgColor-attention-muted);}.Box-row--blue { background-color: var(--bgColor-accent-muted);}.Box-row--gray { background-color: var(--bgColor-muted);}/* Box with btn-octicon *//* Increase specificity when btn-octicon is used because comes after .Box in the cascade */.Box-btn-octicon.btn-octicon { padding: var(--control-medium-paddingInline-spacious); margin: calc(var(--controlStack-small-gap-spacious) * -1); line-height: var(--text-title-lineHeight-large); /* override btn-octicon line-height */ }