Item
Item is a flexible layout container component with built-in skeleton support and common UI props.
Featuresβ
- π Flex layout
- π¨ Styling support
- π Built-in skeleton
- π― Common UI props
Basic Usageβ
import { Item } from '@tansuk/rott-ui';
<Item>
<Label text="Content" />
</Item>
Row Layoutβ
<Item row alignItemsCenter>
<Icon name="STAR" width={20} height={20} />
<Label text="Rating" marginLeft={8} />
</Item>
With Flexβ
<Item flex={1} justifyContentCenter alignItemsCenter>
<Label text="Centered Content" />
</Item>
With Skeletonβ
<Item
skeletonShow={isLoading}
skeletonStyle={{ width: 200, height: 100 }}
>
<Label text="Content" />
</Item>
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Content |
row | boolean | false | Row layout |
flexWrap | 'wrap' | 'nowrap' | - | Flex wrap |
skeletonShow | boolean | false | Show skeleton |
skeletonStyle | SkeletonStyleProps | - | Skeleton style |
Plus all CommonUiProps.
Examplesβ
Cardβ
<Item
padding={16}
backgroundColor="white"
borderRadius={12}
marginBottom={12}
>
<Label text="Card Title" fontSize="lg" fontWeight="bold" marginBottom={8} />
<Label text="Card content" fontSize="sm" variant="grey-800" />
</Item>
List Itemβ
<Item
row
alignItemsCenter
justifyContentSpaceBetween
paddingHorizontal={16}
paddingVertical={12}
>
<Item row alignItemsCenter>
<Icon name="USER" width={24} height={24} marginRight={12} />
<Label text="User Name" />
</Item>
<Icon name="CHEVRON_RIGHT" width={20} height={20} />
</Item>
Grid Itemβ
<Item row flexWrap="wrap">
{items.map((item) => (
<Item key={item.id} width="50%" padding={8}>
<Image source={item.image} width="100%" height={150} />
<Label text={item.title} marginTop={8} />
</Item>
))}
</Item>