Origami Frontend Components & Services

SassDoc: o-spacing

oSpacing(opts)

Output all o-spacing features.

parameter type default description
opts

Example

@include oSpacing($opts: (
	'margin-bottom-utilities': true, // Output CSS classes such as `o-spacing-s1`.
	'custom-properties': true // Output CSS variables.
));

Links

oOverlayContentClose

Overlay close button styles.

The output does not include a class definition, and should be wrapped in a selector.

Example

Output button styles

.my-close-button {
    @include oOverlayContentClose();
}

Links

oSpacingByName(size-name)

parameter type default description
size-name Get a recommended space size by name.

Returns

Number - A px value (or rem value if relative units have been enabled).

Links

oSpacingByIncrement(increment)

parameter type default description
increment The number to multiply the baseline size by.

Returns

Number - A px value (or rem value if relative units have been enabled).

Links

oSpacingGetBaselineValue

Returns

Number - A px value representing our spacing baseline (or rem value if relative units have been enabled).

Links

oButtonsAddTheme(...)

Styles for a custom button theme .o-buttons--[$name].

parameter type default description
name A theme name e.g. `my-special-button`.
opts A custom theme map with a `color` and optional `context` key. The context key indicates the background colour your button is placed on, it defaults to the page colour (paper for the core brand, white otherwise). See [the README](https://registry.origami.ft.com/components/o-buttons/readme) for more details.
types The types of button to output the theme for e.g. ('primary', 'secondary').
icons (optional) null The button icons to output for this theme.

Examples

Example #1

a new claret theme for both primary and secondary buttons.

// Outputs class .o-buttons--my-special-button
@include oButtonsAddTheme(
    $name: 'my-special-button',
    $opts: ('color': 'claret-80'),
    $types: ('primary', 'secondary')
);

Example #2

a new claret theme to go on a slate background.

// Outputs class .o-buttons--my-special-button
@include oButtonsAddTheme(
    $name: 'my-special-button',
    $opts: ('color': 'claret-80', 'context': 'slate'),
    $types: ('primary', 'secondary')
);

Example #3

a new claret theme for buttons with icons.

// Outputs class .o-buttons--my-special-button
@include oButtonsAddTheme(
    $name: 'my-special-button',
    $opts: ('color': 'claret-80'),
    $types: ('primary', 'secondary'),
    $icons: ('arrow-up', 'arrow-down')
);

Links

oButtonsContent(...)

Create a single button with a custom class. To avoid duplicate CSS this is not recommended unless o-buttons default classes cannot be used. See the README for more details.

Button CSS declarations without any selectors.

parameter type default description
opts (optional) ('type': 'null', 'theme': null, 'size': null, 'icon': null, 'icon-only': false) The kind of button styles to output.
include-base-styles (optional) true Whether to include base button styles, shared by all buttons.
include-base-icon-styles (optional) true Whether to include base icon button styles, shared by all icon buttons (defaults to true only when outputting an icon button).

Examples

Example #1

a primary button with right arrow.

.my-button {
    @include oButtonsContent($opts: (
        'type': 'primary',
        'icon': 'arrow-right'
    ));
}

Example #2

a primary button with a custom lemon theme.

.my-lemon-button {
    @include oButtonsContent($opts: (
        'type': 'primary',
        'theme': ('color': 'lemon')
    ));
}

Example #3

base button styles.

Links

o-spacing-relative-units

When true output relative rem space values, not px. Relative spaces will respect the browser's configured font size.

For legacy reasons, this defaults to false (outputs px units). Projects may need to be updated to support relative units.

Links

o-spacing-names

All space names supported by o-spacing.

Links

oSpacing(opts)

Output all o-spacing features.

parameter type default description
opts

Example

@include oSpacing($opts: (
	'margin-bottom-utilities': true, // Output CSS classes such as `o-spacing-s1`.
	'custom-properties': true // Output CSS variables.
));

Links

Status
active
Switch component view

GitHub: o-spacing@3.2.2

Install o-spacing

If using the Build Service, add o-spacing@^3.2.2 to your link tag.

If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-spacing@^3.2.2".

Help & Support

o-spacing is maintained directly by the Origami team. If you have any questions about o-spacing or Origami in general, we are happy to help. 😊

Slack: #origami-support
Email: origami.support@ft.com

Feedback / Issues

To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊

Slack: #origami-support
Email: origami.support@ft.com