Skip to main content

Spacer

Library
UDS Base
Repository
github.com/telus/universal-design-system
Package
npmjs.com/package/@telus-uds/ds-allium
Package version
1.14.0
Loading...

Introduction

import { Spacer } from '@telus-uds/ds-allium'

An empty element used to create a gap between components.

Guidance

Use Spacer where a specific amount of space is needed between two specific items.

Where multiple items require a consistent amount of space between them, use StackView instead.

space prop

The space prop sets the size of the spacer, using the spacing scale. See spacing scale docs for details.

Loading...

direction prop

If used inside a container with flexDirection: 'row', the spacer's direction prop should be set to 'row', which applies the space horizontally.

By default, the direction is column and space is applied vertically.

Loading...

Accessibility

Spacer has no accessibility props and is ignored by accessibility tools such as screen readers.

Platform considerations

The component is available on both native platforms and web.

Props

NameTypeDefaultDescription
direction'column' | 'row''column'The spacer applies space in only one direction, which is controlled by the 'direction' prop: - ''column'' (default) applies space vertically; has a fixed height and not width. - ''row'' applies space horizontally; has a fixed width and not height.
spacespacingIndexPropType | spacingObjectPropType1The size of the spacer according to the theme's spacing scale. Either a number corresponding to a position on the theme's spacing scale (1 is smallest, 2 is second smallest, etc), or, a SpacingObject with viewport keys and options (see 'useSpacingScale' for details).

Tokens

In exceptional circumstances, the following tokens can be passed to this component to override its default styles. Do not do this unless absolutely necessary. Read more about overriding styles.

View Tokens
Prop NameToken PropertyToken Type

Variants

This component does not have any stylistic variants.

Feedback