Tachyons: Question: why the double-dashes?

Created on 17 Jul 2016  Â·  14Comments  Â·  Source: tachyons-css/tachyons

Why are double-dashes in br--top, b--black, absolute--fill etc.?

I copied the syntax in my library: https://github.com/fab1an/react-native-tachyons, but I'm not sure if I'd not rather lose the double-dashes.

Was there a reason for this naming?

Most helpful comment

@fab1an the double dashes are unrelated to bem. They are a result of user testing and watching people struggle to understand why some things weren't working as expected. The double dash indicates that that class relies on the presence of another class to work. I.e b--black does nothing if you put that class on an element. It must be used with bt, ba, bb, br, etc.

Declaring top, bottom, right, left as 0, won't do anything unless you've relative or absolutely positioned the element.

I found that when working with teams of both beginner and expert css folks, the double dashes reduced confusion. But they could likely be documented better here.

All 14 comments

I think it's BEM styling.

*here's a good introduction http://cssguidelin.es/#bem-like-naming

But there's not a double hypen everywhere. bg-black but b--black,

@fab1an the double dashes are unrelated to bem. They are a result of user testing and watching people struggle to understand why some things weren't working as expected. The double dash indicates that that class relies on the presence of another class to work. I.e b--black does nothing if you put that class on an element. It must be used with bt, ba, bb, br, etc.

Declaring top, bottom, right, left as 0, won't do anything unless you've relative or absolutely positioned the element.

I found that when working with teams of both beginner and expert css folks, the double dashes reduced confusion. But they could likely be documented better here.

That makes sense, thanks for the answer.

Btw. I found that "--" is a nice visual reminder of a border, that's why I like them.

@fab1an Any interest in moving your project to the tachyons-css org? Would love to have it as an official part of the ecosystem. But no worries if you are not interested at all.

Thinking about it. What would that imply?

@fab1an Just imply it's officially apart of the ecosystem! You'd be free to continue do whatever you want with the project. It PROBABLY doesn't make a big difference for your project. Ideally it would increase visibility to it and help people looking at the tachyons org to find an additional react resource.

I think I'll keep it separate for now, but I'm thinking about it.

Would it mean merging the documentation or the github repositories?

I'm also not sure how if it wouldn't be too confusing because RN works a little different. (no style inheritance, no % of parent-width, "relative" display by default, restricted flex-box model with different defaults, …)

Nah no merging of repos or docs. It would literally just sit at github.com/tachyons-css and you'd be a made a core contributor that's all. No worries if it isn't of interest.

Ok, let's move it there, since it already shares the names and everything.

{top,left,right,bottom}-1 requires absolute or relative. yet only 1 -.

@mrmrs Transferred it, but I think I accidentally gave push access to everyone, where can I change that?

@fab1an Should be in settings - but it doesn't look like anyone has push access but you. I can test later.

@mrmrs I wasn't admin apparently, works now, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johno picture johno  Â·  6Comments

j-greig picture j-greig  Â·  3Comments

johno picture johno  Â·  6Comments

SiamKreative picture SiamKreative  Â·  7Comments

tabeth picture tabeth  Â·  4Comments