Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

InlineSpacer

The InlineSpacer component creates empty horizontal space between elements. Use InlineSpacer to insert variable amounts of inline-axis spacing when elements need different gaps, such as pushing an action button to the far right of a row.

InlineSpacer supports predefined spacing values from the design token set for consistent horizontal rhythm. When all elements need the same gap, use InlineStack with a spacing prop instead.

Support
Targets (25)

Configure the following properties on the InlineSpacer component.

string

A unique identifier for the component. Use this to target the component in scripts or stylesheets, or to distinguish it from other instances of the same component.

Anchor to spacing
spacing
<Exclude<, 'none'>>
Default: 'base'

The size of the spacer.


Anchor to Add variable horizontal spacingAdd variable horizontal spacing

Use InlineSpacer to insert specific amounts of horizontal space between elements. This is useful when you need different spacing values between items in a row.

Add variable horizontal spacing

An InlineSpacer creating horizontal space between elements.

Add variable horizontal spacing

import {
reactExtension,
InlineSpacer,
InlineStack,
View,
} from '@shopify/ui-extensions-react/customer-account';

export default reactExtension(
'customer-account.page.render',
() => <Extension />,
);

function Extension() {
return (
<InlineStack spacing="none">
<View border="base" padding="base">
View
</View>
<InlineSpacer spacing="loose" />
<View border="base" padding="base">
View
</View>
<InlineSpacer spacing="tight" />
<View border="base" padding="base">
View
</View>
<InlineSpacer spacing="base" />
<View border="base" padding="base">
View
</View>
</InlineStack>
);
}
import {
extension,
InlineSpacer,
InlineStack,
View,
} from '@shopify/ui-extensions/customer-account';

export default extension('customer-account.page.render', (root) => {
const inlineSpacer = root.createComponent(InlineStack, {spacing: 'none'}, [
root.createComponent(View, {border: 'base', padding: 'base'}, 'View'),
root.createComponent(InlineSpacer, {spacing: 'loose'}),
root.createComponent(View, {border: 'base', padding: 'base'}, 'View'),
root.createComponent(InlineSpacer, {spacing: 'tight'}),
root.createComponent(View, {border: 'base', padding: 'base'}, 'View'),
root.createComponent(InlineSpacer, {spacing: 'base'}),
root.createComponent(View, {border: 'base', padding: 'base'}, 'View'),
]);

root.appendChild(inlineSpacer);
});

  • Prefer InlineStack for uniform spacing: If all elements need the same gap, use InlineStack with a spacing prop instead of multiple spacers.
  • Use design token sizes: Stick to predefined spacing values for consistency with the rest of the interface.
  • Avoid excessive spacers: Too many spacers make layout code harder to read. Consider whether a layout component with built-in spacing would be cleaner.

  • InlineSpacer only creates horizontal (inline-axis) space. For vertical spacing, use BlockSpacer.
  • InlineSpacer is an empty element. It can't contain children or display content.
  • Spacing values are limited to the predefined design token set. Custom pixel values aren't supported.

Was this page helpful?