import {Box} from '@primer/react'
<Box sx={{borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default', p: 3}}>Hello</Box>
<Box sx={{borderBottomWidth: 1, borderBottomStyle: 'solid', borderColor: 'border.default', pb: 3}}>Hello</Box>
Use Box to create flexbox layouts.
<Box sx={{display: 'flex'}}><Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>1</Box><Box sx={{flexGrow: 1, p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>2</Box><Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>3</Box></Box>
Use Box to create grid layouts.
<Box sx={{display: 'grid', gridTemplateColumns: '1fr 1fr', gridGap: 3}}><Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>1</Box><Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>2</Box><Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>3</Box></Box>
Name | Type | Default | Description |
---|---|---|---|
ref | React.RefObject<HTMLDivElement> | A ref to the element rendered by this component. Because this component is polymorphic, the type will vary based on the value of the as prop. | |
as | React.ElementType | "div" | The underlying element to render — either a HTML element name or a React component. |
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |