Skip to content

Tailwind style like className but in props #88

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

You must be logged in to vote

Yes by adding tailwind class attributes, you can get attributes. But if you want whole tailwind class as typescript type, then you can do it like this.

import { Tw } from "your_tailwindest_type_src"
type TailwindClassName = Tw[keyof Tw]
// "bg-red-50" | "bg-red-100" | ... all the properties of tailwindcss

Replies: 1 comment 1 reply

Comment options

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

Answer selected by danpacho
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