TACHYONS
Functional CSS for humans.
Quickly build and design new UI without writing CSS.
Principles
- Everything should be 100% responsive
- Everything should be readable on any device
- Everything should be as fast as possible
- Designing in the browser should be easy
- It should be easy to change any interface or part of an interface without breaking any existing interfaces
- Doing one thing extremely well promotes reusability and reduces repetition
- Documentation helps promote reusability and shared knowledge
- CSS shouldn't impede accessibility or the default functionality of HTML
- You should send the smallest possible amount of code to the user
Features
- Mobile-first CSS architecture
- 490 accessible color combinations
- 8px baseline grid
- Multiple debugging utilities to reduce layout struggles
- Single-purpose class structure
- Optimized for maximum gzip compression
- Lightweight (~14kB)
- Usable across projects
- Growing open source component library
- Works well with plain HTML, React, Ember, Angular, Rails and more
- Infinitely nestable responsive grid system
- Built with PostCSS
Getting Started
Docs can be found at http://tachyons.io/docs The modules are generally pretty small and thus quick and easy to read.
Use the CDN
The quickest and easiest way to start using Tachyons is to include a reference to the minified file in the head of your HTML file.
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/tachyons.min.css">
Local Setup
Clone the repo from Github and install dependencies through npm.
git clone https://github.com/tachyons-css/tachyons.git
cd tachyons
npm install
Dev
If you want to just use everything in tachyons/src as a jumping off point and edit all the code yourself, you can compile all of your wonderful changes by running:
npm start
This will output both minified and unminified versions of the CSS to the CSS directory and watch the src directory for changes. It's aliased to the command:
npm run build:watch
If you'd like to just build the CSS once without watching the src directory, run:
npm run build
If you want to check that a class hasn't been redefined or 'mutated,' there is a linter to check that all of the classes have only been defined once. This can be useful if you are using another library or have written some of your own CSS and want to make sure there are no naming collisions. To do this run the command:
npm run mutations
Docs
The tachyons docs located at http://tachyons.io are all open source and located at https://github.com/tachyons-css/tachyons-css.github.io
You can clone the docs and use them as a template for documenting your own design system / patterns / components. While not everything is automated, the component library generation makes it extremely easy to generate and organize the documentation for components as demonstrated at http://tachyons.io/components
Community Resources
- DWYL Learn Tachyons: Learn how to use Tachyons to craft beautiful, responsive, functional and fast UI with minimal CSS
- Tachyons TLDR: Quick lookup for Tachyons classes, scales and color palette
- Tachyons Pro: Fun quiz for memorizing class names
Contributing
Please read our code of conduct for contributors.
Tachyons in Production
A longer list of sites that use tachyons in production can be found in sites.md We love letting the community see what people are building. Please add your link to sites.md in a PR or by opening an issue if you're willing to share to your site or project.
Featured Sites
- https://interfacelovers.com
- https://npmjs.com
- https://womenwho.design
- https://friendstalkfrontend.com
- https://play.webvr.rocks
- https://gohugo.io
- https://coralproject.net
- http://www.philipyoungg.com
- https://gitpoint.co
- https://2017.nodeconf.com.ar
- https://goldenstaterecord.com
- http://hicuties.com
- https://urlbox.io
- https://fontawesome.com
- https://purple3.herokuapp.com
- http://blunt.af/tachy.app/
- https://fenderdigital.github.io/css-utilities/intro/
- https://play.cash
- https://bitmidi.com
And of course...
Sponsors
Development of Tachyons is supported by
Help
If you have a question or need help feel free to open an issue here or jump into the Tachyons slack channel.
How is tachyons different from inline styles?
How is having class="mw-50" different from style="max-width: 50%"? Same goes for the majority of classes I looked through in the css file. I cannot think of a difference other than a cosmetic one. I would argue that the latter is easier to read and remember, and just as easy to type with the right text editor plugins.
You have precisely the same disadvantages:
Add Recommendations on Class/Declaration Order to Docs. (was: "Best Practice for Order of Class Names")
Can we establish and document a recommendation/
best practicearound how order classes? Do I put box first (display, padding, margin) or type, or skin, etc.? What about when writing for media queries and states? I know there are some best practices out there with regards to declaration order within components but those are around CSS methodologies that functional CSS is moving away from so maybe we need an fCSS approach to align the order of our multiple classes?Question: why the double-dashes?
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?
Added `flex` module to the stack, to enable Flex Box Layout implementations.
Regarding #70
df
modifier to the Display module, to setdisplay: flex;
on elements, upgrading them to be flex containers. Also, updated docs file for this module with this new addition.src/_flex.css
source stylesheet module, enlisting several properties and modifiers to compose simple (and complex) flex box layouts.Things to consider:
Class names ideas
Yo community! The README.md here States the following:
So, I would like to spark a conversation here on what could be some future class naming conventions.
How to use css if installed with npm?
I'm really inexperienced with loading css via npm, just need a little bit of example documentation on how I might do that? You say in your docs that it's an option to use npm to install tachyons modules, but there's no mention of how to actually then use it.
Can I simply:
main.js
Do I need some special config with webpack? css-loader?
Thanks for any help, just need pushed in the right direction. Library looks interesting!
Update to normalize 7
Many of the changes introduced by Normalize 6 were disruptive. The project maintainer now believes that to have been a mistake. Normalize 7 has reverted those changes. (There's a long issue thread about the reasons here: https://github.com/necolas/normalize.css/issues/664)
This commit shows what changed in Normalize 7: https://github.com/necolas/normalize.css/commit/b4a8fdaf8321093b1e3cad612fb76cf2b7d3275d
Can we update to Normalize 7?
What is the best way to package a common set of classes together?
Hello,
I've been using tachyons on my current project and found it really helpful in prototyping and editing an existing UI. One thing I did not manage to grasp yet is the best maintainable way to share a common set of classes accross elements.
Let's say, all the buttons in my app are
.link.white.dib.ba.br2.ph3.pv2.ttu.tracked.underline-hover
. How should I handle the possible variations (like size changing for CTA, colors for various actions) while still being able to easily change, say, the border-radius of all buttons at once?The various solutions I tried so far all have drawbacks and I cannot settle on one. Here is what I tried so far:
=partial('button')
. This adds a new layer of complexity (especially if I want to add other classes to that element)..button
class with old-school CSS definitions. I then lose the whole scaling system as I'm back writingwidth
andfont-size
inpx
orrem
again..button
class just like above, but using SCSS and@extend .link
to inherit from the.link
class. This is the approach I like the best so far, but I've run into specificity issues induced by the order in which CSS classes are written preventing me from overwriting properties with new Tachyons CSS classes added on the element.How do you do on your own projects?
A bug, or just me?
I followed the useful video guide, Tachyons - Setting up a new project, and I've hit a problem.
When I run npm start it fails at:
npm run build:watch
Further down it tells me:
Error: ENOENT: no such file or directory, stat 'C:\***\tachyons\run' at Error (native)
I've the latest (stable) versions of node and npm installed. Is this a genuine bug or have I missed something embarrassingly obvious?
Consider incorporating more variables with fallback values
Creating an issue to track our discussion in Slack. I will continue to update this issue as more ideas arise.
Pros
var(--some-var, 4rem);
Cons
Related Reading
Hover classes for border color
I think it would be a great addition if Tachyons had the class:
Is there a reason for not including this?
My use case is to make a button to change its border color on hover.
Update seanoshea.me to https
Updating seanoshea.me from http to https after a redesign. Even though the HTML doesn't include tachyons classes directly, it relies on tachyons in sass placeholder selector format, which then
@extend
semantic class names usinggulp-sass-extend-shorthand
. See the main.scss file in the project repo.🏛 adds row-gap and column-gap to gap.css
Changes
row-gap
andcolumn-gap
to gap.cssMotivation
Having row and column gap classes are very useful for flexbox layouts. Currently there is support for changing row and column gap together but not separately which felt like an oversight. 🙂
⚠️ Reverts the v/h to y/x spacing change
Change
ph2
ormv3
for example).Motivation
px3
doesn't have anything to do with pixels which, even for the initiated, is confusing🐞 fixes a few places where -ns hadn't been replaced by -s
-ns
or-n
instead of-s
-ns
*
from.cf { *zoom: 1; }
*
was a typo in original blog about the clearfix hackimages don't load in components demo
hi guys, i was having a look at the components and noticed that images are missing from the demo at least on these pages below. can someone confirm?
https://tachyons.io/components/marketing/iphone-app/index.html https://tachyons.io/components/layout/flag-object-collapse/index.html https://tachyons.io/components/layout/four-column-collapse-two/index.html https://tachyons.io/components/layout/flag-object/index.html https://tachyons.io/components/layout/flag-object-top/index.html https://tachyons.io/components/layout/flag-object-bottom/index.html
screenshot :
dev tools return a 404 as shown.