File size: 7,380 Bytes
1e92f2d |
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 |
---
title: Border
description: JSX style props for styling border and border radius.
---
## Border Radius
### All sides
Use the `rounded` or `borderRadius` props to apply border radius on all sides of
an element.
```jsx
<Box borderRadius="md" />
<Box rounded="md" /> // shorthand
```
| Prop | CSS Property | Token Category |
| ------------------------- | --------------- | -------------- |
| `rounded`, `borderRadius` | `border-radius` | `radii` |
### Specific sides
Use the `rounded{Left,Right,Top,Bottom}` or
`border{Left,Right,Top,Bottom}Radius` prop, to apply border radius on a specific
side of an element.
```jsx
<Box borderTopRadius="md" />
<Box roundedTop="md" /> // shorthand
<Box borderLeftRadius="md" />
<Box roundedLeft="md" /> // shorthand
```
Use the logical equivalent to make the border radius adapt based on the text
direction.
```jsx
<Box roundedStart="md" />
<Box roundedEnd="md" />
```
| Prop | CSS Property | Token Category |
| ------------------------------------- | ------------------------------------------------------ | -------------- |
| `roundedLeft`, `borderLeftRadius` | `border-left-radius` | `radii` |
| `roundedRight`, `borderRightRadius` | `border-right-radius` | `radii` |
| `roundedTop`, `borderTopRadius` | `border-top-radius` | `radii` |
| `roundedBottom`, `borderBottomRadius` | `border-bottom-radius` | `radii` |
| `roundedStart`, `borderStartRadius` | `border-start-start-radius`, `border-end-start-radius` | `radii` |
| `roundedEnd`, `borderEndRadius` | `border-start-end-radius`, `border-end-end-radius` | `radii` |
### Specific corners
Use the `border{Top,Bottom}{Left,Right}Radius` properties, or the shorthand
equivalent to round a specific corner.
```jsx
<Box borderTopLeftRadius="md" />
<Box roundedTopLeft="md" /> // shorthand
```
Use the logical properties to adapt based on the text direction.
```jsx
<Box borderStartStartRadius="md" />
<Box roundedStartStart="md" /> // shorthand
```
| Prop | CSS Property | Token Category |
| ---------------------------------------- | ---------------------------- | -------------- |
| `roundedTopLeft`,`borderTopLeftRadius` | `border-top-left-radius` | `radii` |
| `roundedTopRight`,`borderTopRight` | `border-top-right-radius` | `radii` |
| `roundedBottomRight`,`borderBottomRight` | `border-bottom-right-radius` | `radii` |
| `roundedBottomLeft`,`borderBottomLeft` | `border-bottom-left-radius` | `radii` |
## Border Width
### All sides
Use the `borderWidth` prop to apply border width on all sides of an element.
> Chakra applies `borderStyle: solid` and a global border color by default.
> Specifying a border width is sufficient to apply the border.
```jsx
<Box borderWidth="1px" />
```
| Prop | CSS Property | Token Category |
| ------------- | -------------- | -------------- |
| `borderWidth` | `border-width` | `borderWidths` |
### Specific sides
Use the `border{Left|Right|Top|Bottom}Width` prop to apply border width on a
specific side of an element.
```jsx
<Box borderTopWidth="1px" />
<Box borderLeftWidth="1px" />
```
Use the logical equivalent to make the border width adapt based on the text
direction.
```jsx
<Box borderInlineStartWidth="1px" />
<Box borderInlineWidth="1px" /> // shorthand
```
| Prop | CSS Property | Token Category |
| --------------------------------------------- | --------------------------- | -------------- |
| `borderTopWidth` | `border-top-width` | `borderWidths` |
| `borderLeftWidth` | `border-left-width` | `borderWidths` |
| `borderRightWidth` | `border-right-width` | `borderWidths` |
| `borderBottomWidth` | `border-bottom-width` | `borderWidths` |
| `borderStartWidth` , `borderInlineStartWidth` | `border-{start+end}-width` |
| `borderEndWidth` , `borderInlineEndWidth` | `border-{start+end}-width` |
| `borderXWidth` , `borderInlineWidth` | `border-{left,right}-width` | `borderWidths` |
| `borderYWidth` , `borderBlockWidth` | `border-{top,bottom}-width` | `borderWidths` |
## Border Color
### All sides
Use the `borderColor` prop to apply border color on all sides of an element.
```jsx
<Box borderColor="red.400" />
// with opacity modifier
<Box borderColor="red.400/20" />
```
### Specific sides
Use the `border{Left,Right,Top,Bottom}Color` prop to apply border color on a
specific side of an element.
```jsx
<Box borderTopColor="red.400" />
<Box borderLeftColor="red.400" />
```
Use the logical properties to adapt based on the text direction.
```jsx
<Box borderStartColor="red.400" />
<Box borderEndColor="red.400" />
```
| Prop | CSS Property | Token Category |
| --------------------------------------------- | -------------------------- | -------------- |
| `borderColor` | `border-color` | `colors` |
| `borderTopColor` | `border-top-color` | `colors` |
| `borderLeftColor` | `border-left-color` | `colors` |
| `borderRightColor` | `border-right-color` | `colors` |
| `borderBottomColor` | `border-bottom-color` | `colors` |
| `borderStartColor` , `borderInlineStartColor` | `border-{start,end}-color` | `colors` |
| `borderEndColor` , `borderInlineEndColor` | `border-{start,end}-color` | `colors` |
| `borderXColor`, `borderInlineColor` | `border-inline-color` | `colors` |
| `borderYColor`, `borderBlockColor` | `border-block-color` | `colors` |
## Divide Width
Use the `divide{X,Y}Width` prop to apply border width between elements. It uses
the CSS selector `> * + *` to apply the `border*` properties.
```jsx
<Box divideXWidth="1px">
<Box>1</Box>
<Box>2</Box>
</Box>
<Box divideYWidth="1px">
<Box>1</Box>
<Box>2</Box>
</Box>
```
| Prop | CSS Property | Token Category |
| ------------- | ----------------------------------- | -------------- |
| `divideWidth` | `border-{inline,block}-start-width` | `borderWidths` |
## Divide Color
Use the `divideColor` prop to apply border color between elements.
```jsx
<Box divideColor="red.400">
<Box>1</Box>
<Box>2</Box>
</Box>
```
| Prop | CSS Property | Token Category |
| ------------- | ---------------- | -------------- |
| `divideColor` | `--divide-color` | `colors` |
## Divide Style
Use the `divideStyle` prop to apply border style between elements.
```jsx
<Box divideX="2px" divideStyle="dashed">
<Box>1</Box>
<Box>2</Box>
</Box>
```
| Prop | CSS Property | Token Category |
| ------------- | ---------------- | -------------- |
| `divideStyle` | `--divide-style` | `borderStyle` |
|