Skip to main content

Spacer

Component to add spacing between elements.
Supports horizontal and vertical spacing, with optional background color for visibility.

Usage

Awesome UI
Blossom UI
function SpacerUsage() {
return (
<View>
<Text>Awesome UI</Text>
<Spacer height={20} />
<Text>Blossom UI</Text>
</View>
)
}

Vertical

Use the width & height prop in conjunction to have the vertical look.

Hello
World
function SpacerVertical() {
return (
<View row>
<Text>Hello</Text>
<Spacer width={100} height={50} />
<Text>World</Text>
</View>
)
}

On Background

Space has the transparent background so it does takes the parent background color.

Awesome UI
Blossom UI
function SpacerOnBackground() {
return (
<View style={{backgroundColor: 'gray'}}>
<Text>Awesome UI</Text>
<Spacer height={20} />
<Text>Blossom UI</Text>
</View>
)
}

Props

PropData TypeDefault ValueDescription
ExtendsRNViewProps--Inherits properties from RNViewProps
widthnumber--Width of the spacer
heightnumber--Height of the spacer