Current version 22.0.0

Spacing directives

import { TgMarginDirective, TgPaddingDirective } from '@trademe/tangram';

Spacing directives are used when it isn’t possible to add custom spacing to component stylesheets.

Improve performance in templates Reduce code bloat by using component stylesheets to add custom spacing where possible.
Heart icon with padding bottom and margin right applied with Tangram spacing directives

Code

<div
    tgPaddingBottom
    tgPaddingBottomSize="unit"
    tgMarginRight
    tgMarginRightSize="base">
    <tg-icon name="heart"></tg-icon>
</div>

Set the appropriate directive and direction, followed by the amount (e.g. tgPaddingSize="base" or tgMarginBottomSize="none")

Multiple spacing settings can be applied by using the generic directive before the sizes (e.g. tgPadding="none", tgPaddingTopSize=”medium”)

Margin
Direction
tgMargin
tgMarginTop
tgMarginBottom
tgMarginLeft
tgMarginRight
tgMarginY
tgMarginX
Amount
none
half
unit
compact
base
medium
large
extraLarge
Padding
Direction
tgPadding
tgPaddingTop
tgPaddingBottom
tgPaddingLeft
tgPaddingRight
tgPaddingY
tgPaddingX
Amount
none
half
unit
compact
base
medium
large
extraLarge
Proudly made by © 2026 Trade Me Limited