Skip to content

Border

A border separates a surface from what is behind it. It survives dark mode, where a black shadow disappears, and it costs less paint work than a shadow.

Class Effect
border 1px solid var(--nc-border)
border-2 / border-4 Wider border, same colour
border-0 Removes the width
border-default Resets the colour to --nc-border
border-accent Uses --nc-accent
border-transparent Keeps the width, hides the line
<div class="border rounded-lg p-4">1px border</div>
<div class="border-2 rounded-lg p-4">2px border</div>
<div class="border-4 rounded-lg p-4">4px border</div>
<div class="border-0 bg-accent text-accent-contrast rounded-lg p-4">No border</div>

The bare border class is the default. Reach for border-2 or border-4 for a deliberate frame, and border-0 to remove a border inherited from a component.

A surface usually needs either a border or a shadow, not both at full strength:

<div class="bg-surface-raised border rounded-lg p-4">Flat surface</div>
<div class="bg-surface-raised rounded-lg shadow-sm p-4">Raised surface</div>
<div class="bg-surface-raised border rounded-lg shadow-xs p-4">Quiet raised surface</div>

Use a border when the surface sits inline with the page, when you need a crisp edge in dark mode, or when the layout should not shift as content changes. Use a shadow when the element really floats above the page. See Shadow for the elevation scale and Radius for the corners.

Border widths and colours have no breakpoint variants. A border that changes with the viewport is rare; write it in a media query or a component class.

The class is the markup shorthand. The same style in a component stylesheet:

.panel {
border: 1px solid var(--nc-border);
}
.panel-accent {
border-color: var(--nc-accent);
}

There is no Sass accessor here; the classes only wrap the border and colour tokens.

A breakpoint is the same declaration inside a media query; you do not need a second class.