Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
    • Alert
    • ButtonDeprecated
    • Collection
    • DateInputDeprecated
    • Dropdown
    • Frame
    • FullWidthModal
    • LegacyTable
    • SearchInputDeprecated
    • SelectOptionItem
    • Table
    • TextDeprecated
    • TooltipDeprecated
  • Deprecated
  • Frame

Frame

Deprecated

Deprecated component

Do not use it in new code. It stays documented to help migrate its remaining usages.

See the migration guide.

Use instead:

  • HStack from murray: For horizontal layouts (direction row).
  • VStack from murray: For vertical layouts (direction column).

A shorthand over flexbox for positioning elements. Use for one-off arrangements that `HStack` and `VStack` do not cover.

Health
Component health
Source
View on Github
Storybook
View in Storybook
Playground
No Example
Accessibility

not-compliant

Platform
Web
Accessibility issues
The props provide interaction without having the related aria and role semantics. The component allows to set fixed width and height.
  • Overview
  • Props

Frame is an abstraction over the FlexBox API to help position elements seamlessly. If you're more comfortable with Flexbox, you can use the VStack or HStack component instead.

A
B
C

Migration Guide​

The Frame component is being deprecated in favor of HStack and VStack components. Here are the main action points for migrating your code:

  1. Identify the Orientation of the Frame: If the Frame component is used to layout elements horizontally, replace it with HStack. If it's used to layout elements vertically, replace it with VStack.
  2. Handle the Gap: The gap property remains, adjust the value by multiplying by 4 and adding the unit px. For example, gap={4} becomes gap="$px16".
  3. Migrate the Properties: The Frame component has a different set of properties compared to HStack and VStack. You need to map the old properties to the appropriate sx css attribute. For example, the alignment property in Frame corresponds to sx={{alignItems: "xxx"}} in HStack and VStack. Check the alignment and distribution props guide below.

Here are some example of how to migrate:

// Before
<Frame
padding={{ bottom: 4 }}
backgroundColor="blue100"
borderRadius="size16"
direction="row"
alignment="stretch-center"
gap={4}
style={{ minWidth: "30vw", maxWidth: "800px" }}
width="fill"
>
{/* ... */}
</Frame>

// After
<HStack
sx={{
paddingBottom: "$px4",
backgroundColor: "$blue100",
borderRadius: "$px16",
justifyContent: "center",
alignItems: "stretch",
minWidth: "30vw",
maxWidth: 800
width: "100%"
}}
gap="$px16"
>
{/* ... */}
</HStack>
// Before
<Frame alignment="middle-center">
{/* ... */}
</Frame>

// After
<VStack sx={{alignItems: "center", justifyContent: "center"}}>
{/* ... */}
</VStack>

hug and fill value​

Frame support the fill and hug value for width and height props. Those are not supported in HStack and VStack

  • fill value becomes width="100%" or height="100%" and according to the direction you can adjust with flexGrow: 1 or alignSelf: "stretch"
  • hug becomes width="fit-content" or height="fit-content"

Alignment and distribution props​

Alignment & Distribution props are now redistribute between alignItems and justifyContent in sx prop.

Here is a non exhaustive list of possible value for alignItems and justifyContent according to the alignment and distribution:

directionalignmentdistributionalignItemsjustifyContent
rowtop-stretchspace-betweenundefinedspace-between
rowtop-stretchspace-aroundundefinedspace-around
rowtop-stretchotherundefinedundefined
rowmiddle-stretchspace-betweencenterspace-between
rowmiddle-stretchspace-aroundcenterspace-around
rowmiddle-stretchothercenterundefined
rowbottom-stretchspace-betweenflex-endspace-between
rowbottom-stretchspace-aroundflex-endspace-around
rowbottom-stretchotherflex-endundefined
rowstretch-leftspace-betweenundefinedspace-between
rowstretch-leftspace-aroundundefinedspace-around
rowstretch-leftotherundefinedundefined
rowstretch-rightspace-betweenundefinedspace-between
rowstretch-rightspace-aroundundefinedspace-around
rowstretch-rightotherundefinedundefined
rowstretch-centerspace-betweenundefinedspace-between
rowstretch-centerspace-aroundundefinedspace-around
rowstretch-centerotherundefinedundefined
rowtop-leftspace-betweenflex-startspace-between
rowtop-leftspace-aroundflex-startspace-around
rowtop-leftotherflex-startundefined
rowtop-centerspace-betweenflex-startspace-between
rowtop-centerspace-aroundflex-startspace-around
rowtop-centerotherflex-startundefined
rowtop-rightspace-betweenflex-startspace-between
rowtop-rightspace-aroundflex-startspace-around
rowtop-rightotherflex-startundefined
rowmiddle-leftspace-betweencenterspace-between
rowmiddle-leftspace-aroundcenterspace-around
rowmiddle-leftothercenterundefined
rowmiddle-centerspace-betweencenterspace-between
rowmiddle-centerspace-aroundcenterspace-around
rowmiddle-centerothercentercenter
rowmiddle-rightspace-betweencenterspace-between
rowmiddle-rightspace-aroundcenterspace-around
rowmiddle-rightothercenterundefined
rowbottom-leftspace-betweenflex-endspace-between
rowbottom-leftspace-aroundflex-endspace-around
rowbottom-leftotherflex-endundefined
rowbottom-centerspace-betweenflex-endspace-between
rowbottom-centerspace-aroundflex-endspace-around
rowbottom-centerotherflex-endundefined
rowbottom-rightspace-betweenflex-endspace-between
rowbottom-rightspace-aroundflex-endspace-around
rowbottom-rightotherflex-endundefined
not rowtop-stretchspace-betweenundefinedspace-between
not rowtop-stretchspace-aroundundefinedspace-around
not rowtop-stretchotherundefinedundefined
not rowmiddle-stretchspace-betweenundefinedspace-between
not rowmiddle-stretchspace-aroundundefinedspace-around
not rowmiddle-stretchotherundefinedundefined
not rowbottom-stretchspace-betweenflex-endspace-between
not rowbottom-stretchspace-aroundflex-endspace-around
not rowbottom-stretchotherflex-endundefined
not rowstretch-leftspace-betweenundefinedspace-between
not rowstretch-leftspace-aroundundefinedspace-around
not rowstretch-leftotherundefinedundefined
not rowstretch-rightspace-betweenundefinedspace-between
not rowstretch-rightspace-aroundundefinedspace-around
not rowstretch-rightotherundefinedundefined
not rowstretch-centerspace-betweencenterspace-between
not rowstretch-centerspace-aroundcenterspace-around
not rowstretch-centerothercenterundefined
not rowtop-leftspace-betweenflex-startspace-between
not rowtop-leftspace-aroundflex-startspace-around
not rowtop-leftotherflex-startundefined
not rowtop-centerspace-betweencenterspace-between
not rowtop-centerspace-aroundcenterspace-around
not rowtop-centerothercenterundefined
not rowtop-rightspace-betweenflex-endspace-between
not rowtop-rightspace-aroundflex-endspace-around
not rowtop-rightotherflex-endundefined
not rowmiddle-leftspace-betweenflex-startspace-between
not rowmiddle-leftspace-aroundflex-startspace-around
not rowmiddle-leftotherflex-startundefined
not rowmiddle-centerspace-betweencenterspace-between
not rowmiddle-centerspace-aroundcenterspace-around
not rowmiddle-centerothercentercenter
not rowmiddle-rightspace-betweenflex-endspace-between
not rowmiddle-rightspace-aroundflex-endspace-around
not rowmiddle-rightotherflex-endundefined
not rowbottom-leftspace-betweenflex-startspace-between
not rowbottom-leftspace-aroundflex-startspace-around
not rowbottom-leftotherflex-startundefined
not rowbottom-centerspace-betweencenterspace-between
not rowbottom-centerspace-aroundcenterspace-around
not rowbottom-centerothercenterflex-end
not rowbottom-rightspace-betweenflex-endspace-between
not rowbottom-rightspace-aroundflex-endspace-around
not rowbottom-rightotherflex-endflex-end

Frame props

NameTypeDefault ValueDescriptionUsage count
alignmentAlignmentundefinedHow children are aligned in the parent Frame. - `stretch` props make children without fixed dimensions to stretch to the size of the parent in the orthogonal direction (horizontal for `column`, vertical for `row`) - ⚠️ Alignment `top-left` doesn't work under `ScrollView`. Please use `top-stretch` instead. (see [this](https://github.com/facebook/react-native/issues/31555))
backgroundColor
94 possibilities"pink500""pink700""pink900""grey200""grey500""grey600""blue700""grey50""grey100""grey200HighContrast""grey300""grey400""grey600HighContrast""grey700""grey800""grey900""blue50""blue100""blue300""blue500""blue900""teal50""teal100""teal300""teal500""teal700""teal900""pink50""pink100""pink300""pink500HighContrast""pink700HighContrast""pink900HighContrast""yellow50""yellow100""yellow300""yellow500""yellow700""whiteAlpha100""whiteAlpha300""whiteAlpha400""whiteAlpha500""whiteAlpha600""whiteAlpha700""whiteAlpha800""whiteAlpha900""white""black""fluoYellow""cream""lightCream""warning""transparent""action""action50""action100""action300""action500""action700""action900""positive""positive50""positive100""positive300""positive500""positive700""positive900""warning50""warning100""warning300""warning500""warning500HighContrast""warning700""warning700HighContrast""warning900""warning900HighContrast""negative""negative50""negative100""negative300""negative500""negative500HighContrast""negative700""negative700HighContrast""negative900""negative900HighContrast""blue""pink""brand""grey""facebook""twitter""linkedin"undefined
borderColor
94 possibilities"pink500""pink700""pink900""grey200""grey500""grey600""blue700""grey50""grey100""grey200HighContrast""grey300""grey400""grey600HighContrast""grey700""grey800""grey900""blue50""blue100""blue300""blue500""blue900""teal50""teal100""teal300""teal500""teal700""teal900""pink50""pink100""pink300""pink500HighContrast""pink700HighContrast""pink900HighContrast""yellow50""yellow100""yellow300""yellow500""yellow700""whiteAlpha100""whiteAlpha300""whiteAlpha400""whiteAlpha500""whiteAlpha600""whiteAlpha700""whiteAlpha800""whiteAlpha900""white""black""fluoYellow""cream""lightCream""warning""transparent""action""action50""action100""action300""action500""action700""action900""positive""positive50""positive100""positive300""positive500""positive700""positive900""warning50""warning100""warning300""warning500""warning500HighContrast""warning700""warning700HighContrast""warning900""warning900HighContrast""negative""negative50""negative100""negative300""negative500""negative500HighContrast""negative700""negative700HighContrast""negative900""negative900HighContrast""blue""pink""brand""grey""facebook""twitter""linkedin"undefined
grey500
borderRadius
11 possibilities"size12""size16""size20""size24""size32""size40""size48""size4""size8""sizeInfinite"undefined
borderType"none""dashed""solid"undefinednone
borderWidthnumberundefined
directionDirectionundefinedcolumn
distributionDistributionundefinedpacked
gapInBaseNumbernumberundefined0Gap between elements within a Frame.
heightSizingundefinedSpecify `fill` for a full-width, `hug` to adapt width to content, or any fixed `number` (in px) Don't fill this prop to let flexbox handle it
hideDown
8 possibilities"xs""sm""md""lg""vs""xl""xxl"undefined
hideUp
8 possibilities"xs""sm""md""lg""vs""xl""xxl"undefined
marginInBaseNumberPaddingOrMarginundefinedPass a ```number``` for uniform margin or a Margin object ```{horizontal:? number, vertical: number}``` for symmetric margin.
overflowXOverflowXundefined
overflowYOverflowYundefined
paddingInBaseNumberPaddingOrMarginundefinedPass a ```number``` for uniform padding or a Padding object ```{horizontal:? number, vertical: number}``` for symmetric padding.
parentFrameDirectionDirectionundefined
widthSizingundefinedSpecify `fill` for a full-width, `hug` to adapt width to content, or any fixed `number` (in px) Don't fill this prop to let flexbox handle it

Deprecated props

NameTypeDefault ValueDescriptionUsage count
classNamestringundefined use `sx` instead
gapnumberundefined use gapInBaseNumber instead
marginPaddingOrMarginundefined use marginInBaseNumber instead
paddingPaddingOrMarginundefined use paddingInBaseNumber instead

Undocumented props

NameTypeDefault ValueDescriptionUsage count
cssany
data-stepany
idany
onClickany
onMouseDownany
onMouseEnterany
onMouseLeaveany
onMouseOutany
onMouseOverany
refany
roleany
styleany
titleany
Edit this page
Previous
Dropdown
Next
FullWidthModal
  • Migration Guide
    • hug and fill value
    • Alignment and distribution props