Understanding Stroke Linejoin
The stroke-linejoin CSS property defines the shape used at the corners of an SVG element's stroked paths. When two path segments meet at an angle, this property determines how that connection point appears visually. You can apply it as a CSS property or as an SVG presentation attribute directly on elements.
The property is particularly important when working with polygons, polylines, and paths with sharp angles. Without explicit control, the default rendering might not match your design intent.
What Stroke Linejoin Controls
Unlike stroke-linecap, which affects path endpoints, stroke-linejoin specifically handles corner geometry. This inherited SVG property can be set on parent containers like <g> elements, affecting all child SVG elements automatically.
The property applies to corner-generating shape elements including circle, ellipse, line, path, polygon, polyline, and rect elements.
Why Corner Styling Matters
Corner styling significantly impacts your design's visual language. Rounded corners create a friendly, approachable feel, while sharp corners convey precision and technical accuracy. Some join types require more rendering calculations than others, though the difference is typically negligible for standard icon usage. For complex SVG systems, optimizing these properties is an important part of web development performance best practices.
1/* Basic syntax for stroke-linejoin */2.icon {3 stroke-linejoin: round;4}5 6/* All available values */7.miter-join {8 stroke-linejoin: miter;9 stroke-miterlimit: 4;10}11 12.round-join {13 stroke-linejoin: round;14}15 16.bevel-join {17 stroke-linejoin: bevel;18}Miter (Default)
Creates sharp, pointed corners by extending outer edges until they intersect. The default SVG behavior since version 1.1.
Round
Creates rounded corners matching stroke width. The standard choice for modern icon systems like Feather Icons.
Bevel
Creates flat corners by cutting off the point. Practical alternative for technical illustrations and maps.
Miter-Clip
Clips the miter point for predictable length. Provides controlled sharp corners within limits.
Miter Join -- The Default Sharp Corner
The miter join creates pointed corners extending from the path intersection. This has been the default since SVG 1.1 and produces precise corner appearance. However, extremely acute angles can create very long miter spikes that may appear visually distracting.
.miter-example {
stroke-linejoin: miter;
stroke-width: 10px;
stroke: #2563eb;
fill: none;
}
Controlling Miter Limits
The stroke-miterlimit property controls when the browser switches from miter to bevel. The default value of 4 represents the maximum ratio of miter length to stroke width before transition occurs:
.icon-miter {
stroke-linejoin: miter;
stroke-miterlimit: 4; /* Default value */
}
.icon-bevel {
stroke-linejoin: miter;
stroke-miterlimit: 1; /* Forces bevel on most angles */
}
When working with complex SVG graphics, understanding how miter limits interact with your designs helps you create more predictable and visually consistent graphics for web applications.
Round Join -- Soft Corner Solution
The round join creates rounded corners matching the stroke width, producing a smooth, organic appearance. This value has become the standard for modern icon systems, popularized by libraries like Feather Icons and early Heroicons.
The radius of the rounded corner is automatically determined based on stroke width, ensuring proportional appearance across different sizes. The friendly appearance makes round joins ideal for social icons and consumer-facing applications.
Bevel Join -- Flat Corner Alternative
The bevel join creates a flat, chamfered corner by cutting off the miter point. This provides a practical alternative when you want predictable geometry without potential long spikes. The bevel creates a slightly different visual effect than miter, preferable for technical illustrations and map features.
.round-join {
stroke-linejoin: round;
}
.bevel-join {
stroke-linejoin: bevel;
}
For teams building modern web interfaces, choosing the right join style is part of creating cohesive design systems that enhance user experience across your digital products.
1interface IconProps {2 children: React.ReactNode;3 join?: 'miter' | 'round' | 'bevel';4 className?: string;5}6 7export function Icon({8 children,9 join = 'round',10 className = ''11}: IconProps) {12 return (13 <svg14 className={className}15 fill="none"16 viewBox="0 0 24 24"17 stroke="currentColor"18 strokeWidth={2}19 strokeLinejoin={join}20 >21 {children}22 </svg>23 );24}25 26// Usage27<Icon join="round">28 <path d="M5 12h14M12 5l7 7-7 7" />29</Icon>SVG Attribute Implementation
Native SVG attributes provide direct control over stroke-linejoin without requiring CSS:
<svg width="200" height="200" viewBox="0 0 200 200">
<!-- Individual element styling -->
<polygon
points="100,20 180,180 20,180"
fill="none"
stroke="#3b82f6"
stroke-width="8"
stroke-linejoin="round"
/>
<!-- Inherited from parent SVG -->
<g stroke-linejoin="bevel">
<rect x="10" y="10" width="50" height="50"
fill="none" stroke="#ef4444" stroke-width="4"/>
<rect x="70" y="10" width="50" height="50"
fill="none" stroke="#ef4444" stroke-width="4"/>
</g>
</svg>
When to use attributes vs CSS:
- Attributes: Inline SVGs, icon systems, simple one-off styling
- CSS: Complex applications, theme systems, animation scenarios
- CSS takes precedence over SVG attributes
Mastering these SVG techniques is essential for developers working on interactive web applications that rely on vector graphics.
1.icon {2 stroke-linejoin: miter;3 transition: stroke-linejoin 0.3s ease;4}5 6.icon:hover {7 stroke-linejoin: round;8}9 10.icon.active {11 stroke-linejoin: round;12 stroke: #3b82f6;13}Browser Compatibility
The stroke-linejoin property has excellent browser support, classified as Baseline with wide availability since April 2017. Supported browsers include Chrome, Firefox, Safari, Opera, and Edge across desktop and mobile platforms.
| Join Type | Browser Support |
|---|---|
| miter | Full support |
| round | Full support |
| bevel | Full support |
| miter-clip | Limited support |
| arcs | No support |
Performance Considerations:
- Round and bevel joins require slightly more calculation than miter
- Difference is negligible for typical icon usage (fewer than 100 elements)
- Use CSS containment for complex SVGs:
contain: paint layout style;
Accessibility Guidelines:
- Ensure sufficient contrast between stroke and background
- Animated transitions should respect
prefers-reduced-motion - Test with Windows High Contrast Mode
- Provide alt text or ARIA labels for icon-only SVGs
Following these accessibility guidelines ensures your SVG graphics are inclusive and perform well across all user contexts in modern web development.