Skip to content

Commit 0137e51

Browse files
committed
docs: document directional border colors
Add documentation for per-side border color utilities: - Add 'Border Colors (Directional)' section in borders.md - Add 'Directional Border Colors' section in colors.md - Document border-{t|r|b|l|x|y} patterns with examples - Include usage with opacity, arbitrary values, and custom colors
1 parent d4334cd commit 0137e51

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

docs/src/content/docs/reference/borders.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,55 @@ description: Border width, radius, and style utilities
8383
<View className="border-dashed" /> // borderStyle: 'dashed'
8484
```
8585

86+
## Border Colors (Directional)
87+
88+
Apply colors to individual border sides. See the [Colors reference](/react-native-tailwind/reference/colors/) for all available color utilities.
89+
90+
### Basic Usage
91+
92+
```tsx
93+
<View className="border-t-red-500" /> // borderTopColor: '#EF4444'
94+
<View className="border-r-blue-500" /> // borderRightColor: '#3B82F6'
95+
<View className="border-b-green-500" /> // borderBottomColor: '#10B981'
96+
<View className="border-l-gray-300" /> // borderLeftColor: '#D1D5DB'
97+
98+
// Horizontal and vertical
99+
<View className="border-x-blue-500" /> // borderLeftColor & borderRightColor: '#3B82F6'
100+
<View className="border-y-red-500" /> // borderTopColor & borderBottomColor: '#EF4444'
101+
```
102+
103+
### With Opacity
104+
105+
```tsx
106+
<View className="border-t-red-500/50" /> // 50% opacity
107+
<View className="border-l-blue-500/80" /> // 80% opacity
108+
```
109+
110+
### Arbitrary Colors
111+
112+
```tsx
113+
<View className="border-t-[#ff0000]" /> // Custom hex color
114+
<View className="border-l-[#abc]" /> // 3-digit hex (expands to #aabbcc)
115+
```
116+
117+
### Combining Width and Color
118+
119+
```tsx
120+
<View className="border-l-4 border-l-blue-500">
121+
// borderLeftWidth: 4
122+
// borderLeftColor: '#3B82F6'
123+
</View>
124+
```
125+
126+
### Example: Accent Border
127+
128+
```tsx
129+
<View className="border border-gray-200 border-l-4 border-l-blue-500 rounded-lg p-4">
130+
<Text className="font-semibold">Important Notice</Text>
131+
<Text className="text-gray-600">This card has a blue left accent border.</Text>
132+
</View>
133+
```
134+
86135
## Common Patterns
87136

88137
### Card with border

docs/src/content/docs/reference/colors.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,39 @@ Apply colors to backgrounds, text, and borders. Supports custom colors via [tail
3535
<View className="border-4 border-red-600" />
3636
```
3737

38+
### Directional Border Colors
39+
40+
Apply different colors to individual border sides:
41+
42+
```tsx
43+
<View className="border-t-red-500" /> // Top border color
44+
<View className="border-r-blue-500" /> // Right border color
45+
<View className="border-b-green-500" /> // Bottom border color
46+
<View className="border-l-gray-300" /> // Left border color
47+
48+
// Horizontal and vertical shortcuts
49+
<View className="border-x-blue-500" /> // Left + right borders
50+
<View className="border-y-red-500" /> // Top + bottom borders
51+
```
52+
53+
Combine with widths for accent borders:
54+
55+
```tsx
56+
<View className="border border-gray-200 border-l-4 border-l-blue-500">
57+
// Gray border on all sides, thick blue left border
58+
</View>
59+
```
60+
61+
Supports all color features (opacity, arbitrary values, custom colors):
62+
63+
```tsx
64+
<View className="border-t-red-500/50" /> // With opacity
65+
<View className="border-l-[#ff0000]" /> // Arbitrary hex color
66+
<View className="border-b-primary" /> // Custom color from config
67+
```
68+
69+
See [Borders reference](/react-native-tailwind/reference/borders/) for more border utilities.
70+
3871
## Available Colors
3972

4073
- **gray**: `50`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`

0 commit comments

Comments
 (0)