Why does tailwind have so few default options for min-width?

I'm getting into using tailwind and so far I've found it far easier to work with than css-in-js or other solutions I've tried in the past. However, I'm wondering why there are so few default options for min-w-*. It kinda makes me think I'm doing something wrong. For example, I have a page with some user generated rich text. I want this to have a max-w-prose so that the lines are always readable. However, on larger screens when the user hasn't entered much text, the rich text area is extremely narrow.
31 Replies
John
John2y ago
1. If you want some specific min-w- you can use arbitary value for example min-w-[69px]. 2. to target larger screens you can use lg: for example your div or whatever has something like min-w-prose lg:min-w-[500px]
cje
cje2y ago
cant you just use w-full max-w-whatever?
nexxel
nexxel2y ago
you can also try unocss where you won't have to do this weird syntax of the boxes, i.e. [] and it is faster, more optimized and has more features
Tom
Tom2y ago
i understand that. i was more just wondering why max-w has for instance max-w-1/2 and max-w-3xl and these dont exist for min-w ok. yeah that makes sense for this use case definitely
cje
cje2y ago
because the point of tailwind is to lead people towards good design decisions and not giving classes for everything is part of that custom values are there for when you need them, but usually using them means you should be reconsidering your layout
Tom
Tom2y ago
ima be honest chief.... i cant keep up with every new framework that comes out for solving every problem. thats kinda why i was excited when i found t3 stack: someone had already picked good solutions that worked for most problems and werent deprecated, badly maintained, buggy, etc. I just googled unocss and it looks nice but it seems very similar i guess thats what im really asking. why is it not good practice to use set sizes for min-width?
nexxel
nexxel2y ago
fwiw you don't need to use it, just giving you an option. it builds on tailwind and makes it better. but that doesn't mean tailwind is bad, its very very good what unocss does different is that its on-demand classes, so for example min-w-3xl can exist in uno it will generate the css for that class for you
Tom
Tom2y ago
its infinitely better than the css-in-js solution i had cobbled together.... i had written this whole app on mui's makeStyles() api, which is now deprecated and didnt work with some of the newer things i wanted. so i kinda made a shim to backport it so my existing styles worked. now im about 2/3 of the way thru redoing everything in tailwind ok. got it. that makes sense
cje
cje2y ago
because min-width usually only makes sense for stuff like keeping buttons consistent for big stuff you can use breakpoints with fixed widths, or 100% with a max you'll figure out why a big min-width is usually a bad idea when you have to modify a bad layout that uses this pattern
Tom
Tom2y ago
yeah im trying to pick up as much about how to do layouting from youtube and stuff but i havent heard anything about this
cje
cje2y ago
youtube is fairly worthless for this stuff tbh the only ways to learn much are building stuff yourself, and inspecting good sites
Tom
Tom2y ago
yeah well i am building this thing, but its hard to just figure out best practices on youer own
cje
cje2y ago
find a site that does a similar thing and look at how they did it i steal most of my css
nexxel
nexxel2y ago
another way to learn best practices (what i did) is just post your project in a lot of discord servers, ask for feedback
cje
cje2y ago
and when you steal enough, you figure out the patterns that work
nexxel
nexxel2y ago
people are more than happy to give constructive criticism on whatever stuff you are doing
Tom
Tom2y ago
do you usually just like post a link to a page? or the css code itself?
nexxel
nexxel2y ago
i just post the github repo and a deployed link if im asking for help/asking for a better way then i will post the relevant code
Tom
Tom2y ago
im getting to the point where it would be really nice for more general feedback so maybe ill do that i can try stealing more too
nexxel
nexxel2y ago
yes you'll level up way faster if you just ask people also while stealing, try to type it out not just copy paste it that way you'll understand it more and what you're exactly doing
Tom
Tom2y ago
yeah i always do that
nexxel
nexxel2y ago
good stuff 👍
Tom
Tom2y ago
is there a channel here for that kind of thing?
nexxel
nexxel2y ago
there's #showcase in this server a lot of other servers have similar channels to share projects
Tom
Tom2y ago
i got timed out once for putting a question in the techncical-discussion channel 😛 ok good to know ill p[ost there in a couple days or so
nexxel
nexxel2y ago
pingthumbsup
Tom
Tom2y ago
https://t3-true-finals.vercel.app/ if anyones interested its gunna be open source, but the codes not..... good enough..... yet
nexxel
nexxel2y ago
don't worry about code not being good
Tom
Tom2y ago
ill try 😛
amanuel
amanuel2y ago
@nexxel, how is it faster? Don't they both just compile into a .css file? Do you mean faster to build?
nexxel
nexxel2y ago
yes and more minified afaik it also supports css splitting ideal for MPAs https://github.com/unocss/unocss#features
Want results from more Discord servers?
Add your server