HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
ben-rogerson
twin.macro
TypeScript2020–2023
ben-rogerson / twin.macro

twin.macro

🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.

9Distinct people
9Mentions
2Explicit recommenders
8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

> Tailwind isn't component-driven, which they claim to be They don't ever claim to be component-driven. They are utility-class library and nothing else. I highly recommend…

EduardoBautista used a recommendation phrase. 2 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year9 dated mentions

Observed mentions: 2020-12-03 07:43:26 UTC to 2023-12-25 00:45:23 UTC.

01232020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC312
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202

What Hacker News says

9 sources
Nice. As far as I understand the projekt this is styled components for tailwind. Probably the author could explain what the difference is to other Projekts which seem to have the same goal. Examples: https://github.com/MathiasGilson/Tailwind-Styled-Component https://github.com/ben-rogerson/twin.macro Would like to see something like this but with compiletime optimization to get rid of the runtime overhead of css-in-js frameworks. Sorry for the stupid questions I‘m only a backend-dev who is playing with the frontend stuff in his sparetime.
In Show HN: TWC – A library to create reusable Tailwind components for React
Although I considered myself good at CSS, but I won't recommend you just learn it like everybody else suggesting in this thread - just build your MVP and pick up things when necessary. Here is my recommendation: 1. You're talking of MVP so I assume the UI doesn't have to be glamorous. Most of the elements you are going to leverage could be UI libs like Material-UI[0] or Ant Design[1]. 2. Then, other than components, sometimes you do need some CSS handle layout and such. My choice would be CSS frameworks like Tailwind[2]. Honestly, to make good use of Tailwind sometimes require good CSS skill, but I believe people could still try Adhoc problem-driven approaches - you'll learn things along the way. In case CSS makes you wonder after the MVP, you could try to expand styles you have been using in Tailwind, to see what's the corresponding CSS
Read the rest
is and you'll learn. (There's also a macro version of Tailwind named twin.macro[3] which fits React better IMO.) (Tailwind has their official UIs (not free) [4] but I never tried them, it might work for you if you don't care about UI) [0] https://material-ui.com/ [1] https://ant.design/ [2] https://tailwindcss.com/ [3] https://github.com/ben-rogerson/twin.macro [4] https://tailwindui.com/
In Ask HN: How to bypass learning CSS?
Regarding performance, twin.macro seems like a fantastic approach for React users, inlining the styles where needed with Emotion/similar. It also answers the "where do custom styles go" question to some extent (answer: the css prop). https://github.com/ben-rogerson/twin.macro Edit: I had stopped reading half way through! This is what the article is about. I'll leave my comment up to publicly shame myself.
In Why I Love Tailwind

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.