Borders & Radius
Border presence
These base classes apply a 1px solid border in currentcolor. All per-side variants extend .border and suppress the other sides.
.border โ border: 1px solid currentcolor
.border-t โ border-top: 1px solid currentcolor
.border-r โ border-right: 1px solid currentcolor
.border-b โ border-bottom: 1px solid currentcolor
.border-l โ border-left: 1px solid currentcolor
.border-x โ border-left + border-right (1px solid currentcolor)
.border-y โ border-top + border-bottom (1px solid currentcolor)
Border width
Generated from $border-sizes: 2, 3, 4, 6, 8 (px). Applied to border-width.
.border-{size} โ border-width: {size}px
Examples:
.border-2 โ border-width: 2px
.border-4 โ border-width: 4px
.border-8 โ border-width: 8px
Note
Width classes set border-width only. Combine with a presence class (.border, .border-t, etc.) to also set border-style and border-color.
Border style
Fixed set โ no scale. Not responsive.
.border-solid โ border-style: solid
.border-dashed โ border-style: dashed
.border-dotted โ border-style: dotted
Remove a border side
Set border-{side} to 0. All six orientations are supported. Also responsive (insert breakpoint name after border-).
.border-t-0 โ border-top: 0
.border-r-0 โ border-right: 0
.border-b-0 โ border-bottom: 0
.border-l-0 โ border-left: 0
.border-x-0 โ border-left: 0; border-right: 0
.border-y-0 โ border-top: 0; border-bottom: 0
Border colour
Generated from the full colour map ($colors + $palettes with tonal grades). Prefix border, property border-color, backed by CSS variables. Responsive.
Pattern: .border-{color} / .border-{color}-{grade}
Named colours ($colors):
.border-foreground โ border-color: var(--color-foreground)
.border-background โ border-color: var(--color-background)
.border-black โ border-color: var(--color-black)
.border-white โ border-color: var(--color-white)
.border-primary โ border-color: var(--color-primary)
Palette colours ($palettes) โ each seed generates grades 100โ900 on a shared lightness ladder; 300/400 are the border grades:
.border-gray-500 โ border-color: var(--color-gray-500)
.border-red-300 โ border-color: var(--color-red-300) (lightened)
.border-blue-700 โ border-color: var(--color-blue-700) (darkened)
Available palette names: gray, yellow, orange, red, violet, purple, indigo, blue, teal, green, lime.
Grades: 100 (lightest) โ 500 (base) โ 900 (darkest).
Border radius
Generated from $border-radiuses: 0, 4, 6, 8, 16, 24, 32 (px names). Prefix rounded. Not responsive. Radius only โ these classes set border-radius and nothing else.
.rounded-{size} โ border-radius: {size} in rem (.rounded-8 โ 0.5rem)
Examples:
.rounded-0 โ border-radius: 0
.rounded-4 โ border-radius: 0.25rem (4px)
.rounded-8 โ border-radius: 0.5rem (8px)
.rounded-16 โ border-radius: 1rem (16px)
.rounded-32 โ border-radius: 2rem (32px)
The radius token:
.rounded โ border-radius: var(--radius) (0.25rem by default)
Bare .rounded reads the --radius custom property โ the component corner
radius, seeded from $border-radius, which is an alias
into a step of $border-radiuses. Re-declare --radius under any scope to
retheme every .rounded corner at runtime; see
Design Tokens.
Radii convert under $rem-units โ a curve is
antialiased, so the pixel-snapping problem that keeps border widths in px does
not apply, and a corner on a box whose padding and text grew should grow with
them. .rounded-full stays a literal 9999px cap; it is a shape, not a step on
the scale.
Full circle:
.round โ border-radius: 50%
Pill:
.rounded-full โ border-radius: 9999px
.round is a circle โ 50% of both axes, so a wide element becomes an ellipse.
.rounded-full is a stadium: the radius is capped at half the shorter side, so
the ends stay semicircular at any width. Use it for pills, tags and badges.
Clipping child content
Rounding an element does not clip what's inside it. If a child reaches the
rounded corner โ a full-bleed image, a filled swatch โ add .overflow-hidden:
<div class="rounded-8 overflow-hidden">
<img src="โฆ" alt="โฆ">
</div>
Note
Up to v2, every rounded-* class carried overflow: hidden implicitly, via a
[class*='rounded-'] selector. That clipped box-shadows, dropdowns and focus
rings on any element with a radius, and applied even to .rounded-tl-0, whose
only job is to un-round a corner. It is gone as of 3.0.0 โ clipping is opt-in
now.
Per-corner and per-side zero overrides
Hard-coded classes to zero out individual corners or sides. Only 0 is available (no other values).
| Class | CSS |
|---|---|
.rounded-tl-0 |
border-top-left-radius: 0 |
.rounded-tr-0 |
border-top-right-radius: 0 |
.rounded-bl-0 |
border-bottom-left-radius: 0 |
.rounded-br-0 |
border-bottom-right-radius: 0 |
.rounded-t-0 |
border-top-left-radius: 0; border-top-right-radius: 0 |
.rounded-b-0 |
border-bottom-left-radius: 0; border-bottom-right-radius: 0 |
.rounded-l-0 |
border-top-left-radius: 0; border-bottom-left-radius: 0 |
.rounded-r-0 |
border-top-right-radius: 0; border-bottom-right-radius: 0 |
Responsive
Border width classes are responsive. Insert the breakpoint name between the prefix and the value.
Pattern: .border-{bp}-{size}
.border-md-4 โ border-width: 4px (min-width: 48rem)
.border-lg-8 โ border-width: 8px (min-width: 64rem)
.border-t-md-0 โ border-top: 0 (min-width: 48rem)
Border colour classes are not responsive โ .border-md-primary does not exist. See Color.
Breakpoints (all min-width):
| Name | Min-width |
|---|---|
sm |
26.25rem (420px) |
md |
48rem (768px) |
lg |
64rem (1024px) |
xl |
85.375rem (1366px) |
xxl |
105rem (1680px) |
Note
Classes without a breakpoint segment apply at all viewport widths. Responsive variants layer on top via min-width media queries.