API Reference
BoxLayoutProps
The shared layout prop type extended by every component — spacing, sizing, flex, custom shorthands, and $-prefixed breakpoint groups.
What is BoxLayoutProps?
BoxLayoutProps is a TypeScript type that bundles all layout-related props:
- Responsive spacing props (padding, margin)
- Responsive sizing props (width, height)
- Responsive flex props (flex, flexDirection, alignItems, gap, …)
- Custom shorthands declared in your
createUi({ shorthands })config, each wrapped inResponsive<T> $-prefixed breakpoint props ($sm,$md, …) derived from yourcreateUi({ media })config
ℹ
Every component in
@stareezy-ui/components extends BoxLayoutProps. You can pass layout props directly to any component — they are forwarded to the root element automatically.Every component accepts these props
import {
Button, Input, Card, Badge, Accordion,
Avatar, Checkbox, Dropdown, Modal,
Progress, Skeleton, Spinner, Switch, Tabs,
Breadcrumb, Pagination, Table, Tag, Tooltip, Drawer,
} from '@stareezy-ui/components'
// Spacing on any component
<Button p={{ base: 8, md: 12 }} mb={16} />
<Input mx={12} mt={8} />
<Card p={{ base: 12, md: 20, lg: 28 }} />
<Badge px={8} py={4} />
// Sizing on any component
<Button w={{ base: '100%', md: 'auto' }} />
<Input w={{ base: '100%', md: 360 }} />
<Modal maxW={560} />
// $-prefixed breakpoint groups
<Card
$md={{ flexDirection: 'row', p: 20 }}
$lg={{ p: 28, gap: 16 }}
/>With custom shorthands
Custom shorthands from your stareezy.config.ts are also part of BoxLayoutProps after module augmentation. They accept both plain values and responsive objects.
// With shorthands: { br: 'borderRadius', w: 'width', h: 'height' } as const
<Button
p={{ md: 16 }}
w="100%"
br={8}
/>
// TypeScript knows 'br', 'w', 'h' are valid on Button because
// Button extends BoxLayoutProps which includes CustomShorthandPropsSpacing props
| Prop | CSS/RN property | Type |
|---|---|---|
p | padding | number | string | Responsive<...> |
px | paddingHorizontal | number | string | Responsive<...> |
py | paddingVertical | number | string | Responsive<...> |
pt | paddingTop | number | string | Responsive<...> |
pb | paddingBottom | number | string | Responsive<...> |
pl | paddingLeft | number | string | Responsive<...> |
pr | paddingRight | number | string | Responsive<...> |
m | margin | number | string | Responsive<...> |
mx | marginHorizontal | number | string | Responsive<...> |
my | marginVertical | number | string | Responsive<...> |
mt | marginTop | number | string | Responsive<...> |
mb | marginBottom | number | string | Responsive<...> |
ml | marginLeft | number | string | Responsive<...> |
mr | marginRight | number | string | Responsive<...> |
Sizing props
| Prop | CSS/RN property | Type |
|---|---|---|
w / width | width | number | string | Responsive<...> |
h / height | height | number | string | Responsive<...> |
minW / minWidth | minWidth | number | string | Responsive<...> |
maxW / maxWidth | maxWidth | number | string | Responsive<...> |
minH / minHeight | minHeight | number | string | Responsive<...> |
maxH / maxHeight | maxHeight | number | string | Responsive<...> |
Flex props
| Prop | CSS/RN property | Type |
|---|---|---|
flex / f | flex | number | Responsive<number> |
flexDirection | flexDirection | 'row' | 'column' | Responsive<...> |
flexWrap | flexWrap | 'wrap' | 'nowrap' | Responsive<...> |
flexGrow | flexGrow | number | Responsive<number> |
flexShrink | flexShrink | number | Responsive<number> |
alignItems | alignItems | 'center' | 'flex-start' | ... | Responsive<...> |
alignSelf | alignSelf | 'center' | 'flex-start' | ... | Responsive<...> |
justifyContent | justifyContent | 'center' | 'space-between' | ... | Responsive<...> |
gap | gap | number | string | Responsive<...> |
rowGap | rowGap | number | string | Responsive<...> |
columnGap | columnGap | number | string | Responsive<...> |
extractBoxLayoutProps utility
When building custom components that should accept BoxLayoutProps, use extractBoxLayoutProps to split layout props from component-specific props:
import { extractBoxLayoutProps, Box } from '@stareezy-ui/components'
import type { BoxLayoutProps } from '@stareezy-ui/components'
interface MyCardProps extends BoxLayoutProps {
title: string
children: React.ReactNode
}
function MyCard({ title, children, ...props }: MyCardProps) {
const { layout, rest } = extractBoxLayoutProps(props)
return (
<Box {...layout} style={{ borderRadius: 12 }}>
<h3>{title}</h3>
{children}
</Box>
)
}
// Usage — layout props are accepted
<MyCard title="Hello" p={{ base: 12, md: 20 }} mb={16}>
Content here
</MyCard>✦
All built-in components already call
extractBoxLayoutProps internally — you only need it when building your own components that should accept the same layout API.