Box
Box is the most abstract component on top of which all other Pearl UI components are built. By default, it renders a React Native View element.
The Box component improves the development experience in the following ways:
- Create flexible layouts with ease.
- Provides an easier way to pass styles via props (
backgroundColorcan be passed as a prop instead of using React Stylesheet or inline styles). Shorthand props are also supported (bginstead ofbackgroundColor). - Create more complex components using
Boxas the base component, instead ofView(All components in Pearl UI useBoxunder the hood).
Import#
import { Box } from "pearl-ui";Usage#
<Box width="100%" height={200} backgroundColor="primary.500" marginBottom="m"> This is a box</Box>Example#
Props#
Supported style props#
The Box component supports the following style props:
- backgroundColor (Only
backgroundColorprops are supported, not thecolorprop) - layout
- position
- opacity and visiblity
- margin and padding
- border
- shadow