ComponentsShape
RoundedRectangle
RoundedRectangle is a rectangular shape with rounded corners. RoundedRectangle is commonly used for cards, buttons, and modern UI elements.
RoundedRectangle is a rectangular shape with rounded corners. RoundedRectangle is commonly used for cards, buttons, and modern UI elements.
Examples
Basic Usage
Preview unavailable for this example in the static docs build.
Show code
<RoundedRectangle fill="#007AFF" cornerRadius={12} style={{ width: '200px', height: '100px' }}></RoundedRectangle>Different Corner Radius
Preview unavailable for this example in the static docs build.
Show code
<VStack spacing={10}>
<VStack spacing={5}>
<RoundedRectangle fill="#007AFF" cornerRadius={4} style={{ width: '200px', height: '50px' }} />
<Text>Radius: 4</Text>
</VStack>
<VStack spacing={5}>
<RoundedRectangle fill="#007AFF" cornerRadius={12} style={{ width: '200px', height: '50px' }} />
<Text>Radius: 12</Text>
</VStack>
<VStack spacing={5}>
<RoundedRectangle fill="#007AFF" cornerRadius={20} style={{ width: '200px', height: '50px' }} />
<Text>Radius: 20</Text>
</VStack>
</VStack>API
| Prop | Type | Required | Description |
|---|---|---|---|
fill | string | No | Fill color |
stroke | string | No | Stroke color |
strokeWidth | number | No | Stroke width |
cornerRadius | number | No | Corner radius Default: 8 |
Inherits additional props from IBaseComponent.
Overview
RoundedRectangle is a rectangular shape with rounded corners. RoundedRectangle is commonly used for cards, buttons, and modern UI elements.
SwiftUI Correspondence: Similar to SwiftUI's RoundedRectangle.
Different Corner Radius
Adjust the corner radius:
Notes
- RoundedRectangle requires
fillandcornerRadiusprops - RoundedRectangle requires explicit dimensions via
styleprop cornerRadiuscontrols the roundness of corners- RoundedRectangle supports optional
strokeandstrokeWidthprops - Use RoundedRectangle for cards, buttons, and modern UI elements
Best Practices
- Corner radius: Use consistent corner radius values
- Dimensions: Always provide explicit dimensions
- Fill color: Always provide a fill color
- Modern design: RoundedRectangle is ideal for modern, friendly designs
- Accessibility: Ensure rounded rectangles have sufficient contrast