Skip to content

Using an alias key name for space #2098

@francinen

Description

@francinen

Hello! Our design team is rolling out a new naming convention for our design tokens. One of the changes requires space tokens to use the spacing prefix instead of space. I'm trying to configure an alias based on the code snippet in your documentation, but it hasn't been successful for me yet.

Is there anything we're missing in the way we're configuring our alias?

const config = {
   spacing: {
        property: 'spacing',
        scale: 'space',
   }
}

config.space = config.spacing;

const customSystemProps = system(config)

// Elsewhere in the module, the customSystemProps is composed along with other functions imported from `styled-system`
const styleFunctions = [
  background,
  border,
  color,
  flexbox,
  layout,
  position,
  shadow,
  typography,
  customSystemProps,
];

const styleProps = compose(...styleFunctions);

export const Base: React.FunctionComponent<BoxProps> = styled('div', {
  shouldForwardProp,
})({ boxSizing: 'border-box' }, (props: BaseProps) => ({
  ...styleProps(props),
 // etc.
})) as React.FunctionComponent<BoxProps>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions