Components
Color
Color is a view that displays a solid color. Color is used to display color swatches, backgrounds, and visual color indicators.
Color is a view that displays a solid color. Color is used to display color swatches, backgrounds, and visual color indicators.
Examples
Basic Usage
Preview unavailable for this example in the static docs build.
Show code
<Color color="#007AFF" style={{ width: '200px', height: '100px' }}></Color>Color Palette
Preview unavailable for this example in the static docs build.
Show code
<VStack spacing={10}>
<HStack spacing={10}>
<Color color="#007AFF" style={{ width: '100px', height: '50px' }} />
<Text>Blue</Text>
</HStack>
<HStack spacing={10}>
<Color color="#34C759" style={{ width: '100px', height: '50px' }} />
<Text>Green</Text>
</HStack>
<HStack spacing={10}>
<Color color="#FF9500" style={{ width: '100px', height: '50px' }} />
<Text>Orange</Text>
</HStack>
<HStack spacing={10}>
<Color color="#FF3B30" style={{ width: '100px', height: '50px' }} />
<Text>Red</Text>
</HStack>
</VStack>API
| Prop | Type | Required | Description |
|---|---|---|---|
color | string | Yes | Color value (CSS color string) |
Inherits additional props from IBaseComponent.
Overview
Color is a view that displays a solid color. Color is used to display color swatches, backgrounds, and visual color indicators.
SwiftUI Correspondence: Similar to SwiftUI's Color.
Color Palette
Display multiple colors:
Notes
- Color requires a
colorprop (hex, rgb, or named color) - Color requires explicit dimensions via
styleprop - Color can be used as a background or visual indicator
- Color supports all CSS color formats
- Use Color for color swatches and visual indicators
Best Practices
- Dimensions: Always provide explicit dimensions
- Color formats: Use consistent color formats (hex recommended)
- Accessibility: Ensure sufficient contrast when using Color
- Visual indicators: Use Color for visual feedback and indicators
- Consistency: Use consistent colors throughout your app