Back to Material Ui

Borders

docs/data/system/borders/borders.md

9.0.03.3 KB
Original Source

Borders

<p class="description">Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.</p>

Border

Use border utilities to add or remove an element's borders. Choose from all borders or one at a time.

Additive

{{"demo": "BorderAdditive.js", "defaultCodeOpen": false, "bg": true}}

jsx
<Box sx={{ border: 1 }}>…
<Box sx={{ borderTop: 1 }}>…
<Box sx={{ borderRight: 1 }}>…
<Box sx={{ borderBottom: 1 }}>…
<Box sx={{ borderLeft: 1 }}>…

Subtractive

{{"demo": "BorderSubtractive.js", "defaultCodeOpen": false, "bg": true}}

jsx
<Box sx={{ border: 0 }}>…
<Box sx={{ borderTop: 0 }}>…
<Box sx={{ borderRight: 0 }}>…
<Box sx={{ borderBottom: 0 }}>…
<Box sx={{ borderLeft: 0 }}>…

Border color

{{"demo": "BorderColor.js", "defaultCodeOpen": false}}

jsx
<Box sx={{ borderColor: 'primary.main' }}>…
<Box sx={{ borderColor: 'secondary.main' }}>…
<Box sx={{ borderColor: 'error.main' }}>…
<Box sx={{ borderColor: 'grey.500' }}>…
<Box sx={{ borderColor: 'text.primary' }}>…

Border-radius

{{"demo": "BorderRadius.js", "defaultCodeOpen": false}}

jsx
<Box sx={{ borderRadius: '50%' }}>…
<Box sx={{ borderRadius: 1 }}>… // theme.shape.borderRadius * 1
<Box sx={{ borderRadius: '16px' }}>…

API

js
import { borders } from '@mui/system';
Import namePropCSS propertyTheme key
borderborderborderborders
borderTopborderTopborder-topborders
borderLeftborderLeftborder-leftborders
borderRightborderRightborder-rightborders
borderBottomborderBottomborder-bottomborders
borderColorborderColorborder-colorpalette
borderTopColorborderTopColorborder-top-colorpalette
borderRightColorborderRightColorborder-right-colorpalette
borderBottomColorborderBottomColorborder-bottom-colorpalette
borderLeftColorborderLeftColorborder-left-colorpalette
borderRadiusborderRadiusborder-radiusshape