Skip to main content
/
/
/
Box

Box

Customizable box to apply bifrost background, padding, shadow, and border.

Class names

The react <Box> component provides a way to access CSS classes with some default values for bifrost styling:

Class nameApplied style
.bf-padding padding: var(--bf-box-padding);
.bf-padding-x padding-inline: var(--bf-box-padding);
.bf-padding-y padding-block: var(--bf-box-padding);
.bf-border border: var(--bf-border);
.bf-border-top border-top: var(--bf-border);
.bf-border-right border-right: var(--bf-border);
.bf-border-bottom border-bottom: var(--bf-border);
.bf-border-left border-left: var(--bf-border);
.bf-radius border-radius: var(--bf-radius-m);
.bf-shadow box-shadow: var(--bf-shadow);

In addition to .bfc-[color]-bg background-color classes.

They are based on bifrost variables like:

CSS variableValue
--bf-box-padding 16px up to 1280px viewport width, 24px for wider
--bf-border 1px solid var(--bfc-base-c-dimmed)
--bf-radius 12px
--bf-shadow 0 0 var(--bf-shadow-blur) var(--bfc-shadow)

Combining these you can compose different boxes:

Border

Padded box with a border and rounded corners.

bf-padding bf-radius bf-border

Background color

Valid background color classnames are:

.bfc-base-bg
.bfc-base-2-bg
.bfc-base-3-bg
.bfc-dimmed-bg
.bfc-inverted-bg
.bfc-inverted-2-bg
.bfc-disabled-bg
.bfc-theme-bg
.bfc-theme-fade-bg
.bfc-neutral-bg
.bfc-neutral-fade-bg
.bfc-brand-bg
.bfc-brand-fade-bg
.bfc-attn-bg
.bfc-attn-fade-bg
.bfc-chill-bg
.bfc-chill-fade-bg
.bfc-success-bg
.bfc-success-fade-bg
.bfc-warning-bg
.bfc-warning-fade-bg
.bfc-alert-bg
.bfc-alert-fade-bg
bf-padding bf-radius bfc-base-3-bg
bf-padding bf-radius bfc-chill-bg
bf-padding bf-radius bfc-warning-bg

Clickable box

Use .bf-neutral-link to remove default link or button styling, and wrap any text you would like underlined on hover in .bf-neutral-link-text.

Button

To make a "box" clickable, use the<button> element to make it accessible.

The .bf-block class applies display: block; width: 100%; when applied to a <button>.

Anchor (<a>) elements are inline by default, to use it as a "box", you can either apply display: block; or use the .bf-block class which does just that.

Use .bf-box-arrow (or .bf-box-arrow-external) on an arrow-right icon to animate on hover.

You can place it on the right hand side using .bf-inline and .bf-inline-stretch.

Examples

Card with button

Also see typography docs, .bfl-grid, and .bf-button

Ingrid Berntsen

Sosialantropolog med utdanning fra Universitetet i Oslo (UiO).

Circle icon card

Message to signees
Don't forget to celebrate

Split card

27
cats
4
Burmese
3
Voids
20
Orange ones