Style Properties
Style properties in Pearl UI offer a convenient method to apply styling to components by passing properties directly to them. This feature enhances developer productivity and ensures the readability of complex components remains intact.
#
ReferenceThe following sections provide a comprehensive list of supported style properties and the values they accept.
#
Margin and padding// m="1" refers to the value of `theme.spacing["1"]`<Box m="1">Tomato</Box>
// pt="3" refers to the value of `theme.spacing["3"]`<Box pt="3">Red</Box>
Prop | Stylesheet property | Type |
---|---|---|
m , margin | margin | |
mt , marginTop | marginTop | |
mr , marginRight | marginRight | |
mb , marginBottom | marginBottom | |
ml , marginLeft | marginLeft | |
mx , marginHorizontal | marginHorizontal | |
my , marginVertical | marginVertical | |
ms , marginStart | marginStart | |
me , marginEnd | marginEnd | |
p , padding | padding | |
pt , paddingTop | paddingTop | |
pr , paddingRight | paddingRight | |
pb , paddingBottom | paddingBottom | |
pl , paddingLeft | paddingLeft | |
px , paddingHorizontal | paddingHorizontal | |
py , paddingVertical | paddingVertical | |
ps , paddingStart | paddingStart | |
pe , paddingEnd | paddingEnd |
#
Color and Background Color// bgColor="primary.500" refers to the value of `theme.palette["primary"]["500"]`<Box bgColor="primary.500">Primary Box</Box>
// The specified 'light' and 'dark' values get activated based on the current color mode of the theme<Box color={{ light: "neutral.200", dark: "primary.100" }}>Red</Box>
Prop | Stylesheet property | Type |
---|---|---|
bgColor , backgroundColor | backgroundColor | |
color | color |
#
Opacity and Visibility<Box opacity={0.3}>Translucent Box</Box>
<Box visible={false}>Hidden Box</Box>
Prop | Stylesheet property | Type |
---|---|---|
opacity | opacity | |
visible | visible |
#
Layout<Box width="100%" height={200}> Translucent Box</Box>
<Box width="100%" height={50} flex={1} flexDirection="row" justifyContent="space-between"> <Box width={20} height={50}> 1 </Box> <Box w={50} h={30} maxHeight={50}> 2 </Box> <Box w={30} maxW={40} height={50}> 3 </Box></Box>
Prop | Stylesheet property | Type |
---|---|---|
w , width | width | |
h , height | height | |
minW , minWidth | minWidth | |
maxW , maxWidth | maxWidth | |
minH , minHeight | minHeight | |
maxH , maxHeight | maxHeight | |
overflow | overflow | |
aspectRatio | aspectRatio | |
alignContent | alignContent | |
alignItems | alignItems | |
alignSelf | alignSelf | |
justifyContent | justifyContent | |
flex | flex | |
flexBasis | flexBasis | |
flexDirection | flexDirection | |
flexGrow | flexGrow | |
flexShrink | flexShrink | |
flexWrap | flexWrap |
#
Transform<Box transform={[ { rotate: "45deg" }, { scale: 2 }, { translateX: -50 }, { translateY: -50 }, ]}> <Text>Transformed Box</Text></Box>
Prop | Stylesheet property | Type |
---|---|---|
transform | transform | |
transformMatrix | transformMatrix | |
rotation | rotation | |
scaleX | scaleX | |
scaleY | scaleY | |
translateX | translateX | |
translateY | translateY |
#
Position<Box top={20} alignItems="center" justifyContent="center" width="100%" position="absolute"> Absolute box</Box>
Prop | Stylesheet property | Type |
---|---|---|
position | position | |
top | top | |
right | right | |
bottom | bottom | |
left | left | |
start | start | |
end | end | |
zIndex | zIndex |
#
Border// borderColor="tomato" refers to the value of `theme.palette["tomato"]`// borderRadius="l" refers to the value of `theme.borderRadii["l"]`<Box backgroundColor="neutral.100" width="40%" height={200} borderStyle="solid" borderWidth={2} borderColor="tomato" borderRadius="l"> Absolute box</Box>
Prop | Stylesheet property | Type |
---|---|---|
borderBottomWidth | borderBottomWidth | |
borderLeftWidth | borderLeftWidth | |
borderRightWidth | borderRightWidth | |
borderStyle | borderStyle | |
borderTopWidth | borderTopWidth | |
borderStartWidth | borderStartWidth | |
borderEndWidth | borderEndWidth | |
borderWidth | borderWidth | |
borderColor | borderColor | |
borderTopColor | borderTopColor | |
borderRightColor | borderRightColor | |
borderLeftColor | borderLeftColor | |
borderBottomColor | borderBottomColor | |
borderStartColor | borderStartColor | |
borderEndColor | borderEndColor | |
borderRadius | borderRadius | |
borderBottomLeftRadius | borderBottomLeftRadius | |
borderBottomRightRadius | borderBottomRightRadius | |
borderTopLeftRadius | borderTopLeftRadius | |
borderTopRightRadius | borderTopRightRadius | |
borderBottomStartRadius | borderBottomStartRadius | |
borderBottomEndRadius | borderBottomEndRadius | |
borderTopStartRadius | borderTopStartRadius | |
borderTopEndRadius | borderTopEndRadius |
#
Typography// textShadowColor="blue" refers to the value of `theme.palette["blue"]`<Text lineHeight={12} textAlign="center" textDecorationLine="underline" textShadowColor="blue"> This is a demo text</Text>
Prop | Stylesheet property | Type |
---|---|---|
fontFamily | fontFamily | |
fontSize | fontSize | |
fontWeight | fontWeight | |
letterSpacing | letterSpacing | |
lineHeight | lineHeight | |
fontStyle | fontStyle | |
textAlign | textAlign | |
textDecorationLine | textDecorationLine | |
textDecorationStyle | textDecorationStyle | |
textTransform | textTransform | |
textShadowOffset | textShadowOffset | |
textShadowRadius | textShadowRadius | |
textShadowColor | textShadowColor |
#
Shadow// boxShadow="l" refers to the value of `theme.elevation["l"]`<Box boxShadow="l">Theme Shadow box</Box>
// shadowColor="neutral.800" refers to the value of `theme.palette["neutral"]["800"]`<Box shadowOffset={{width: 20, height: 10}} shadowColor="neutral.800" shadowRadius={13} shadowOpacity={0.7}> Custom Shadow box</Box>
Prop | Stylesheet property | Type |
---|---|---|
boxShadow | shadowOffset + shadowOpacity + shadowRadius + elevation + shadowColor | |
shadowColor | shadowColor | |
shadowOffset | shadowOffset | |
shadowOpacity | shadowOpacity | |
shadowRadius | shadowRadius |
#
Text Shadow// textShadowColor="primary.300" refers to the value of `theme.palette["primary"]["300"]`<Text textShadowColor="primary.300" textShadowOffset={{ width: 2, height: 5 }} textShadowRadius={2}> Text with some sweet shadow</Text>
Prop | Stylesheet property | Type |
---|---|---|
shadowColor | shadowColor | |
textShadowOffset | textShadowOffset | |
textShadowRadius | textShadowRadius |