DEV Community

Cover image for Flexbox cheatsheet inside VS Code
Dzhavat Ushev
Dzhavat Ushev

Posted on • Originally published at dzhavat.github.io

Flexbox cheatsheet inside VS Code

This post was originally published on my blog.


Another week, another VS Code extension. I’ve published two so far and this is my third in just a month. I’m not participating in any sort of “30 VS Code extensions” challenge 😂. It’s just the ideas that keep popping up in my head and I can’t help myself but try to make something out of them.

It’s needless to say that I enjoy doing this quite a lot because these extensions are something I’ve been missing in my work. So by building them, I benefit directly and they make my work as a front-end developer a little bit easier.

Over the last few years flexbox got more and more popular. And rightly so, because it helps us build one-dimensional layouts much faster. Have you tried positioning something in the middle of an element using flexbox? It’s fun, right?

But there’s just one problem! Remembering all flexbox properties can be hard. I know it’s hard for me! Should I use justify-content or align-items to do X? What values does justify-content accept? There are quite many of them and we’re not always sure which one does what. That’s why we have our favorite articles, guides, cheatsheets, etc., to consult during those times. But they all “live” outside of the code editor and that forces us to switch context.

A week ago I asked myself “Why not have a flexbox cheatsheet inside VS Code where I can quickly look up what I need and continue my work? Why do I need to switch context? Why isn’t there a tool that lets me do that?”. That’d be great, right?

I think so too, so I built it! 🚀

I’m thrilled to share my new extension “CSS Flexbox Cheatsheet”. Here’s a little demo:

Demo

Currently there are two ways to open the cheatsheet:

  • By pressing Ctrl+Shift+P (Win) / Cmd+Shift+P (Mac) and searching for the Open Flexbox Cheatsheet command.
  • Hovering any display: flex declaration and clicking the Open Flexbox Cheatsheet link in the popup (as shown in the demo).

I have a few ideas for future improvements but I’d like to share it with the world in order to get feedback. So if you work with CSS, please give it a try. I hope you find it useful.

Oldest comments (39)

Collapse
 
lucashogie profile image
Lucas H.

Thank you so much! I love it.

Collapse
 
macariojames profile image
Macario James

Oh! Installing this as soon as I get to my computer for the morning.

Collapse
 
macariojames profile image
Macario James • Edited

Update. I'm LOVING this. The visual representation of each attribute is exactly what I needed. I learned something. I was like, so THAT'S what "align-item: stretch" does. Sweet.

Added first review to the marketplace! Time to check out your other extensions.

Collapse
 
macariojames profile image
Macario James

Question, how did you create the .svg images for each attribute?

Thread Thread
 
dzhavat profile image
Dzhavat Ushev

The whole cheatsheet is based on the excellent work by Darek Kay. I'm not sure which tools he used to create them but you can check out the code on GitHub. :)

Collapse
 
dzhavat profile image
Dzhavat Ushev

Thanks for your review! Really appreciate it 🙏

Hope you find the other extensions useful as well :)

Collapse
 
kaos profile image
Kai Oswald

Now make one for CSS Grid, where you can generate and export your grid 😉.

Collapse
 
dzhavat profile image
Dzhavat Ushev

That's a really good idea :)

I might give it a try in the future, or of someone wants to take on the challenge, he/she can do it as well.

It's going to be great if my little extension inspires other people to build more tools like this embedded in the code editor.

Collapse
 
s_aitchison profile image
Suzanne Aitchison

It's not an extension but this generator is pretty amazing cssgrid-generator.netlify.com/

Collapse
 
dzhavat profile image
Dzhavat Ushev

Yes, it is! Sarah Drasner has released a lot of amazing tools. All of them deserve to be bookmarked :)

Collapse
 
n8trufe profile image
n8trufe

Thank you for that. I will install it immediately. If you would make the same with Grid would be awesome.
I also love your css to MDN.

Collapse
 
dzhavat profile image
Dzhavat Ushev

Thanks. Hope it serves you well :)

Will appreciate your feedback once you've used them for some time. If you feel like there's something that can be improved, let me know.

Collapse
 
vasily93 profile image
Vasily93

Awesome!! Loved it!

Collapse
 
siddev profile image
Siddhant Jaiswal

Very helpful and useful extension ❤️❤️❤️

Collapse
 
mehdiraash profile image
Mehdi Raash

If someone needs to see this cheatsheet to solve the problem, the problem wouldn't be solved!

Collapse
 
dzhavat profile image
Dzhavat Ushev • Edited

I see what you mean and I agree. But many times the problem is remembering the right property, not much about the end result.

Collapse
 
s_aitchison profile image
Suzanne Aitchison

So good! I can stop mixing up align-items and justify-content now 🙈

Collapse
 
dzhavat profile image
Dzhavat Ushev

I feel you! Hope this little tool can help you with that :)

Collapse
 
nickytonline profile image
Nick Taylor

Nice work @dzhavat ! 💪🏻🗳️

Collapse
 
refiloedig profile image
Refiloe Digoamaye

genius!