Skip to content
Discussion options

You must be logged in to vote

Also, what do you mean by "on a component basis"? If you want to have predictable variable names for each component, then you can do that with createGlobalThemeContract. All it returns is an object mapping keys to variable names, so there's nothing stopping you from using it in a separate .css.ts file for each component.

For example:

// Button.css.ts
export const buttonVars = createGlobalThemeContract(
  {
    container: {
      // --button_vars_container_color
      color: null
    },
    hover: {
      // --button_vars_hover_color
      color: null
    }.
  },
  (_value, path) => `button_vars_${path.join('_')}`
);

You can customize this to your liking, adding in any prefixes/suffixes/fo…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@olivierpascal
Comment options

Comment options

You must be logged in to vote
4 replies
@olivierpascal
Comment options

@olivierpascal
Comment options

@askoufis
Comment options

Answer selected by olivierpascal
@olivierpascal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants