Skip to content

How to type a custom color #87

Answered by danpacho
ShalltearFR asked this question in Q&A
Discussion options

You must be logged in to vote

Oh you can add custom properties with Tailwindest type's generic argument like this. Happy coding :)

export type Tw = Tailwindest<{
	color: "primary" | "secondary" | "tertiary" | "accent"
}>

// access background color
type Bg = Tw["backgroundColor"]

Replies: 1 comment 1 reply

Comment options

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

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