tachyons-css / tachyons

Functional css for humans
https://tachyons.io
MIT License
11.64k stars 677 forks source link

v5 Suggestions #211

Open mrmrs opened 8 years ago

mrmrs commented 8 years ago

After so much time on v4 I have a fairly good idea of what I want to do with version 5, but I'm open to suggestions as well. This is an issue to track said suggestions from the community.

garrensmith commented 8 years ago

I would love to see more components. Ideally we could build out the components so that we have nice libraries to use with React, Ember and other libraries as well.

lachlanjc commented 8 years ago

Related: tachyons-css/tachyons-lists#3

mrmrs commented 8 years ago

@lachlanjc not really the type of thing I am interested in for v5. More interested in pushing forward documentation, performance, and making sure the design system is as cohesive as possible. Class names are quite trivial and can be customized by end users to fit their needs if they don't work for them.

lachlanjc commented 8 years ago

@mrmrs Agreed, they are pretty trivial (just wanted to mention it as a possible breaking change). Sorry I haven't been able to work on the new docs recently…I'll be getting back to it.

lachlanjc commented 8 years ago

Some things I think we could look at for v5/beyond

Docs & guides

Modules

Misc

Kind of a long list…let me know whatever your thoughts @mrmrs 😀

chenghanlee commented 8 years ago

agreeing garrensmith and lachlanjc:

  1. Would love to see additional documentation on components, especially on best practices for creating forms and menus.
  2. Would love to see additional guides on grids. Coming from bootstrap --> basscss, I am still trying to wrap my head around grids without using columns.
kentor commented 8 years ago

translucent -> opaque hovers (opposite of dim):

e.g.

.hover-o-10 { opacity: .1 }
.hover-o-10:hover { opacity: 1 }

etc

mrmrs commented 8 years ago

@kentor will add something along those lines for 4.5.0

ixley commented 8 years ago

@lachlanjc I agree with your reco to apply breakpoints more sparingly. An alternative for the ns slug could be to use -gts and -lts alongside plain ol' -s. Greater than and less than are appropriate descriptors for breakpoints, where -gts = min-width: [s-breakpoint], -lts = max-width: [s-breakpoint - 1px], and -s could either default to (min-width: [s-breakpoint]) and (max-width: [m-breakpoint - 1px]) OR could simply be the default for greater-than (min-width) media queries (depending on whether you want more options or simple conventions for combining).

btnwtn commented 8 years ago

I would like to propose dropping the -ns, -m, and -l suffixes and introduce using @ to denote responsive modifiers. I took this idea from CSS Wizardry's BEMIT article, implemented the idea at my workplace, and it has worked wonderfully for us.

It is easier to quickly parse and understand a string of class="p0 pb2@l m0 mt4@m" than class="p0 pb2-l m0 mt4-m". I think Harry worded it a bit better than me:

The @ is a human readable and logical way of denoting conditional states. It allows developers to learn about any potential permutations or appearances that the piece of UI in question might have, just at a glance.

The only potential downside that I can see is that we would have to escape the @ in source, like so:

.m0\@l {
  /* ... */
}
mrmrs commented 8 years ago

@btnwtn Thanks for the suggestion, I'm glad you're having success with this with your team. Understand why some people like this but I think the downside you mentioned is quite significant and goes against some core Tachyons principles. Because of this, we won't be adding any class names that contain characters that need to be escaped.

ajusa commented 8 years ago

@btnwtn I actually really like that idea. While it makes sense for mrmrs to not incorporate it, I think it would be possible to create a fork with just that change that is always updated with the newest release of Tachyons.

I'll edit this when I have a working fork with the "@" in .

billaddison commented 8 years ago

For the breakpoint nomenclature, I'd suggest: -a (all) -s (small) -m (medium) -l (large)

Knowing the media queries are mobile-first, you'd know that "-a" is a bottom-up query which can be overridden by -s, -m or -l. Although you'd never explicitly use the "-a" class, it creates context for understanding the other three classes.

mrmrs commented 8 years ago

@billaddison thanks for the suggestion. We won't be changing these extensions as that would be a breaking change. For v5, we'll be dropping -ns and moving -m to a min-width only query.

dfosco commented 8 years ago

@mrmrs does dropping -ns means we would need to use both -m and -l classes in an element to target all desktop screen sizes?

mrmrs commented 8 years ago

@dfosco nope, -m would then be equivalent to what -ns is now.

abinxzh commented 8 years ago

@mrmrs I guess that makes a lot of sense (especially if you haven't grown very used to the 'previous' method). My only concern would be that it'd take a while for some to change all their -ns's to -m's. I guess that's why you should use vim 😉...

sebastienbarre commented 7 years ago

Minor, but maybe add a f7 font scale (e.g. 12px) ? I realize you can customize/rebuild tachyons.css to make f6 smaller, but I was attempting to make badges recently, and f6 at 14px is too big. Most (if not all) the badges I've seen in other frameworks use 12px (see examples for Ant, Semantic UI, uikit, Material Design Lite, Material UI).

.f7 {
  font-size: 0.75rem;
}

Thank you.

UPDATE: it's in 4.7, woop woop.

mrmrs commented 7 years ago

@sebastienbarre have been debating adding it as it seems heavily used.

sebastienbarre commented 7 years ago

Maybe add media queries for viewport/screen aspect ratios?

Say I build a full-bleed cover page (aka bg-center cover), with contents below the fold, and my photo is originally 3x2 (aka from a full frame camera). This looks pretty good on laptops, desktops, or iPad horizontally, because the aspect ratio is similar. I might lose some pixels on the horizontal edges, but proportionally not that many. On a phone with a 9x16 aspect ratio though, this end up cropping a large part of the photo to fill the whole screen vertically. If that photo is important (say, the best picture of the interior of a house), I may want to try a different version for that cover page, targeted at "vertical" aspect ratios, to make sure most of the picture is there. Just a use-case.

mrmrs commented 7 years ago

@sebastienbarre Think that should be handled with custom css. Adds too much weight to account for orientation queries and last I checked (although could be incorrect now) they aren't as reliable as queries based on widths.

thangngoc89 commented 7 years ago

I don't know if this is the right place to say it but thank you for making this awesome project. I'm purely a developer with zero design skills. At day work, I usually work with designers and I admire them. I tried to mess With CSSand designing but it was bad.

I learnt about tachyons about a month ago and it literally changed my life. I'm now don't have to touch a single css line but stills produce decent looking product. Thank you so much.

But as a developer whi are obcessed with speed, embeding the whole tachyons stylesheet is kind of redundant when you are only use a portion of it.

So I challenge myself to build a build system to reduce the size of tachyons based on each project.

Here is my ideas:

No working version yet but I want to give a head up first.

lachlanjc commented 7 years ago

@thangngoc89 That's great to hear! Thanks for posting. If you'd like, you can join our Slack team to chat with other users/contributors: http://tachyons-slack-invite.herokuapp.com/ 💬

Also, there's an open PR for a custom build tool already in progress over here: tachyons-css/tachyons-css.github.io#46 It's not finished, but if you want to, maybe you could contribute there? 🛠

thangngoc89 commented 7 years ago

@lachlanjc I think that's not what I'm having in mind. My goal is to export css that tailored for each project. Only used selector will be included. For ex: if you only use "red" in you site, the other colors would be discarded.

subic commented 7 years ago

@thangngoc89 Depending on your build process purifycss might be what you are looking for.

thangngoc89 commented 7 years ago

@subic thanks.I'll look into it

ooloth commented 7 years ago

Thanks so much for Tachyons! It's awesome.

One addition I'd love to see are the "flex-grow", "flex-shrink" and "flex-basis" properties. Sometimes it would be useful to set them differently than the included ".flex-auto" and ".flex-none" allow.

For example, when using ".justify-between" with three flex items, it would be helpful to be able to set the flex-basis of each item to zero so that differences in the widths of each item don't throw off the centering of the middle item.

thangngoc89 commented 7 years ago

@ooloth there are some suggestions already http://codepen.io/dangayle/pen/NbmWza

As I have read in every flexbox tutorial, you should not specify "flex-grow", "flex-shrink" and "flex-basis" seperately, just use the "flex" shorthand syntax. It shorter (for sure) and less error-prone since "flex" will override all of those 3 properties.

btnwtn commented 7 years ago

@thangngoc89 it should be worth noting that flex: 1 doesn't produce the same results in IE11 and some older, but still popular, versions of Safari.

mrmrs commented 7 years ago

@thangngoc89 If you only want to send necessary css/styles down the wire - I have found a declarative approach to be better suited for that. Removing unused css can be brittle in my experience. And it seems like kind of an anti-pattern anyways. If you are using react / jsx it's pretty easy to use something that allows you to keep a design system like the one in tachyons, while also allowing you to only declare needed styles for a given component / view. http://github.com/jxnblk/cxs is my favorite but aphrodite, stylematic, and many others will allow for comparable solutions. Tachyons is great but if you do want the absolute minimum of css - I'd suggest using a css in js solution.

thangngoc89 commented 7 years ago

@mrmrs I used css in js in several project before and I don't have any opinion about it. They are good. But I like tachyons because of consistent. I'm bad as designing. Tachyons out of the box gives me a consistent looks for every component. You know. Bigger padding? pa1 to pa2. And like you said, removing unused css is very hard. I spent a day or two on that but it got me nowhere

timpish commented 7 years ago

Reorganize Docs and Components IA. I find it difficult to navigate, Margin and Padding both under the "Spacing' label, individual fonts at the root, etc. I spend a lot of time trying to find stuff, but this could just be because I'm new to it? Did you run any open and/or closed card sorts?

jmlivingston commented 7 years ago

Excellent work by the way. I'm really digging the framework and completely refactoring a Bootstrap project.

lachlanjc commented 7 years ago

Seconding print classes. I use my .dn-p class a ton to hide navigation, flashes, etc in my projects.

lachlanjc commented 7 years ago

So overall what I'm seeing here:

I think :+1: to all.

subic commented 7 years ago

With flexbox I lately use auto margins enough to require helper classes for them (.m[l/r/t/b]a).

More as something useful to consider than a required feature.

AlJohri commented 7 years ago

Adding a +1 to the grid and flex docs. Specifically, how to create a grid using the flex classes similar to bootstrap 4's grid system.

EDIT: here's another example of how a flex-1 (and perhaps flex-2, 3 etc.) classes could be helpful

http://codepen.io/anon/pen/mWMvKP

bates64 commented 7 years ago

I think it'd be nice to have some kind of build step - postcss plugin! - that selectively turns modules like

.red { color: red }

to

.red { color: red }
@media (min-width: 50em) { .red\@m\A  { color: red } } /* yes, \@ is valid css */
@media (min-width: 80em) { .red\@l\A  { color: red } }

With options in tachyons-cli to selectively add more breakpoints.

<h1 class='blue red@l'> red on large screen widths </h1>

Same goes for :hover classes:

.f2 { font-size: 4rem }
.f2\3A hover\A :hover { font-size: 4rem } /* confusing i know */

Used in this way:

<div class='f1 f2:hover'> hover over me </div>

Interesting characters are allowed within class names and this'd be a great usecase for them.

lachlanjc commented 7 years ago

@nanalan Hey! I see what you're going for, but I'm not convinced that using characters that need to be (very confusingly, in the case of :) escaped is better than what we're using right now. I think red:hover is harder to type in the HTML/JS than red-hover, plus it needs these odd methods of escaping in the CSS (that are very much not friendly to a beginner dev/new Tachyons user).

Feel free to fork with that method (we encourage all kinds of variants!), or just use those extensions in your own projects, but I don't think we should add those to Tachyons. @mrmrs?

levibostian commented 7 years ago

I am seeing a bit of discussion here talking about improving the docs. I am thinking back to when I first started using Tachyons and what would have helped me get into it more.

  1. A getting started guide. The homepage now goes over what Tachyons is, why to use it, and that's all great. A "getting started" guide (aka: get up and running with Tachyons) is almost complete in the site because it's bits and pieces are laid all over the place. A formal doc to getting started would help new users get up and running nice and quick.
  1. How Tachyons does mobile support. I came from Bootstrap (as I know many people come to Tachyons from) and I was looking for the grid system module of Tachyons to find out, there isn't one. I am lucky to have access to my buddy @mrkhdly that walked me through how to do mobile support in Tachyons using db, dib, w-30.fl, w-70.fl, etc. Perhaps put this in the getting started guide as well. Links to a couple blog posts for "coming from bootstrap?" to help walk people through it.

  2. Add search in the docs. Yes. I already use the crap out of: https://roperzh.github.io/tachyons-cheatsheet/ so why not put that functionality into the official docs?


Something else I would love to see more of is the incorporation of design into Tachyons. I am a developer at heart but I have learned design concepts and have become a much better designer because of Tachyons. Having Tachyons provide design best practices is awesome. The docs having some design concepts built in is awesome. If there are ways we can help devs and designers become better designers, that would be pretty amazing of an accomplishment. You have already done it for me. I am wondering how we can do that for others.

Along with that, how can we make devs and designers better at accessibility? Contrast in a site is an example.


A few other random notes.

  1. I don't use the components often. I like them for inspiration, but I do not use them directly. I used them much more when I was learning Tachyons to say, "Oh. That is how you do that in Tachyons" (yes, even though Tachyons is just plain ol CSS, I learned I was pretty bad at CSS!).
  2. I have the entire Tachyons lib installed on all of my sites. I have not broken it down by module via npm installing before. I simply install Tachyons SASS and use webpack with uncss to break it down for me.
GiorgioMartini commented 7 years ago

Will v5 be backwrds compatible with v4 ? and will we have to do a lot of refactoring if we want to upgrade to v5 ?

tvler commented 7 years ago

Here are some small classes I've had to add to my tachyons project that I think would be beneficial for the library:

.overflow-scrolling-touch { -webkit-overflow-scrolling: touch; }
.b--currentColor { border-color: currentColor; }
.bg-currentColor { background-color: currentColor; }
.touch-action-none { touch-action: none; }
.top-100 { top: 100%; }
.right-100 { right: 100%; }
.bottom-100 { bottom: 100%; }
.left-100 { left: 100%; }

I'm especially interested in the currentColor additions. I know that we can compile the library with a different color palette, but for small projects where I'd just make the class .custom-blue, making use of currentColor would be very helpful. Thanks for the awesome library!

ctjhoa commented 6 years ago

Some additions that I found useful for my project:

// RESIZE
// Useful for textarea
.resize-h { resize: horizontal; }
.resize-v { resize: vertical; }
.resize-none { resize: none; }

// SVG
// Mix with tachyons color you can apply tachyons color to svg
.fill {
    fill: currentColor;
}

// OVERFLOW WRAP
// Very useful when you deal with a lot of text
.overflow-wrap {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

// WHITE-SPACE
// Very useful when you deal with a lot of text
.pre-wrap {
    white-space: pre-wrap;
}
.pre-line {
    white-space: pre-line;
}

// ABSOLUTE POSITION 100%
.top-100    { top:    100%; }
.right-100  { right:  100%; }
.bottom-100 { bottom: 100%; }
.left-100   { left:   100%; }

// ABSOLUTE POSITION 50%
.top-50    { top:    50%; }
.right-50  { right:  50%; }
.bottom-50 { bottom: 50%; }
.left-50   { left:   50%; }

// BORDER-ONLY
// Useful to create separator or material design input like
@mixin generate_border_only($name, $position) {
    $positions: "top", "right", "bottom", "left";

    .b#{$name}--only {
        @each $p in $positions {
            @if($p == $position) {
                border-#{$p}-style: solid;
                border-#{$p}-width: 1px;
            } @else {
                border-#{$p}-style: none;
                border-#{$p}-width: 0;
            }
        }
    }
}
@include generate_border_only("t", "top")
@include generate_border_only("r", "right")
@include generate_border_only("b", "bottom")
@include generate_border_only("l", "left")

// VISIBILITY
.v-hidden { visibility: hidden; }

// POINTER EVENTS
.pe-none { pointer-events: none; }

I do not understand clearly the naming convention but you can pick whatever you like

radubrehar commented 6 years ago

Currently, .vh-25, .vh-50, .vh-75, .vh-100 have no vw - width equivalent - would be nice if they did.

Also, for .min-vh-100 should have also variations for 25vh, 50vh, 75vh. Also have clases for min-vw - min-width

In fact, would be nice if we had vw and vh classes for multiples of 10, besides the multiples of 25 there already exist

dumconstantin commented 6 years ago

Here's my take on responsive:

screens: {
    'ns': '30em',
    'm': '48em',
    'l': '60em'
  }

with m widthout an upper-bound.

luizbills commented 6 years ago

Better box-shadow. Inspiration: https://tailwindcss.com/docs/shadows

cmnstmntmn commented 6 years ago

what's the fuss about tailwindcss? it's ugly and hard.

proyb6 commented 6 years ago

Support -xl for logical resolution of 67.5em aka 1080px (width) and common screen width.

matthewmorek commented 6 years ago

@proyb6 Since -l already target's 60em, I think -xl should target a viewport more substantial, such as 75em or above (80em comes to mind as a good breakpoint, in both 1280px and 1440px variants, depending on the base font-size).

onetrev commented 6 years ago

This is going to cause some people to freak out probably as there is an old guard defensiveness about this, but I would suggest breakpoints should actually be migrated to be px based and not em. One good explanation why.