Skip to content

API for creating my own properties / values #415

Answered by rtkaaho
LukasBombach asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

So this is possible, but there is a funky typing issue with this. Ironically, so long as your properties object contains at least one valid css property from the CSSType lib it will work. For example, adding padding will remove the type error:

const responsiveProperties = defineProperties({
  properties: {
    paddingLeft: [10, 20, 30, 40],
    layout: {
      stack: {
        display: "grid"
      },
      columns: {
        display: "grid",
        gridAutoFlow: "column",
      }
    }
  }
});

// create the atoms
export const atoms = createSprinkles(responsiveProperties);

// export the atoms type
export type Atoms = Parameters<typeof atoms>[0];

// consuming the atoms
const myLayo…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by LukasBombach
Comment options

You must be logged in to vote
2 replies
@LukasBombach
Comment options

@markdalgleish
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