Skip to main content

Function: flatten()

flatten<T>(style?): SizableStyleProps<T> extends U[] ? U : SizableStyleProps<T>

Defined in: utils/style.ts:87

Flattens a style prop into a single style object.

Type Parameters

T

T extends object

Parameters

style?

StyleProp<SizableStyleProps<T>>

The style prop to flatten

Returns

SizableStyleProps<T> extends U[] ? U : SizableStyleProps<T>

Flattened style object

Example

const flattenedStyle = Styler.flatten([
{ padding: 10 },
{ margin: 5 },
{ backgroundColor: 'red' }
]);