-
+
+
+ BigDesign core theme provides a pre-defined set of spacing values that are primarily used with any of the{' '}
+ padding and margin props. There are a few ways we can consume these
+ values.
+
+ When to use:
+
+
+ Using the Margin and Padding props.
+
+ Consuming it from the theme in a custom component.
+
+
+
+
+ (
+
+
+ Certain components will include padding and margin props.
+ You can use the spacing keys to apply spacing values to those props.
+
+
+ {/* jsx-to-string:start */}
+ <>
+
+
+ >
+ {/* jsx-to-string:end */}
+
+
+ ),
+ },
+ {
+ id: 'style',
+ title: 'Applying to a style',
+ render: () => (
+
+ You can also use spacing directly from the theme to style other components.
+
+ {/* jsx-to-string:start */}
+ {function Example() {
+ const StyledBox = styled(Box)(({ theme }) => ({
+ backgroundColor: theme.colors.primary,
+ height: theme.spacing.large,
+ width: theme.spacing.large,
+ }));
+
+ return ;
+ }}
+ {/* jsx-to-string:end */}
+
+
+ ),
+ },
+ ]}
+ />
+
+
+
+
+ {Object.keys(spacing)
+ .reverse()
+ .map((key) => (
+
+ {key}
+
+
+ ))}
+
+
>
);
};