Floating Labels with Tailwind CSS

Поделиться
HTML-код
  • Опубликовано: 31 дек 2024
  • НаукаНаука

Комментарии • 152

  • @himanshusrivastava931
    @himanshusrivastava931 3 года назад +107

    Whenever a new video comes from this channel, first I 'like' the video then I watch it. 😁

    • @themsaid
      @themsaid 3 года назад +4

      Simon is GOAT

    • @dotkeyz
      @dotkeyz 3 года назад +1

      Just did now 😁

    • @MrSonicastra
      @MrSonicastra 3 года назад +1

      Haha i do the same :)

    • @KunalGulati7
      @KunalGulati7 3 года назад +1

      Hi Himanshu, would like to connect with you on call for some tailwind theme creation if interested let me know.

    • @iamfaizanarif
      @iamfaizanarif 3 года назад +1

      Same 2 u

  • @rfmiotto
    @rfmiotto 3 года назад +40

    Again, one more awesome material by Tailwind Labs!
    You are a game changer for web developers. I also learned CSS a lot from you.

  • @igdev6095
    @igdev6095 3 года назад +21

    You guys can add "select-none" and "pointer-events-none" for best experience!

    • @87whateva
      @87whateva 2 года назад +1

      Thank you very much. That was the missing piece for a great UX!

  • @jeffnikelson5824
    @jeffnikelson5824 2 года назад

    you're a magician man
    just found out about tailwind and every day I'm more and more convinced
    thank you so much

  • @mc-ty4br
    @mc-ty4br 3 года назад +2

    Without those screencasts, I'd only know about the basics of tailwindcss. Thank you!

  • @ApoorvMote
    @ApoorvMote 3 года назад +8

    I have about 20 forms on my site. This is going to dramatically change everything. Thanks Tailwind.

  • @isaaccloos1084
    @isaaccloos1084 3 года назад +9

    Yooo, that shot at the end was great 👍🏻

    • @simonswiss
      @simonswiss 3 года назад

      My son just read that! ✨ Thank you 🙏

  • @swyxTV
    @swyxTV 3 года назад +4

    Simon you’re crushing it. Love the demo and the editing and the music!

    • @simonswiss
      @simonswiss 3 года назад +1

      Thanks! 🙏 Yeah I am slowly getting the hang of it all 🎉

  • @flanger001
    @flanger001 2 года назад +6

    You entirely changed my mind on this pattern. I hated this when I first saw it because it was always implemented some buggy JS that interfered with password managers. But a pure CSS implementation? Absolute genius. Thank you 💜

  • @Yaxqb
    @Yaxqb 3 года назад +6

    This is insane and i would never in my life want to implement this in raw css
    Bravo!!!

  • @sharvinpingulkar3844
    @sharvinpingulkar3844 Год назад

    Thank you! You solved my issue and changed my thought process on how to approach this kind of issue. Keep smashing!

  • @pagarevijayy
    @pagarevijayy 3 года назад +1

    I thought the end of the video will be like.. now tailwind takes care of all of this in our forms plugin lol. Nice video btw!

  • @BharatKumarDhaker
    @BharatKumarDhaker 3 года назад +1

    Cool tips, I was looking this for days, -- One thing left in there I think, -- cursor ---> label in text area cause issue to override the cursor-text -- so the solution is --> label default & peer-focus 'cursor-default' and in peer-placeholder-shown it should be cursor-text

  • @andreich1980
    @andreich1980 3 года назад +4

    Great stuff! I did this just the other day. Some more of UX improvements: add this classes to labels `pointer-text pointer-events-none`.

  • @RyanRampersad
    @RyanRampersad 3 года назад +3

    This is really great. Thanks for making a video on it. The pattern is popular and while I think it looks funny and actually more confusing, I understand why people like it!

  • @Laratips
    @Laratips 3 года назад +1

    Mind blowing. Doing this only with css is just amazing.

  • @AndresMarquezOk
    @AndresMarquezOk 2 года назад

    The best effect is 7:14 "pru".. Great video! Thanks!!!

  • @shafu_xyz
    @shafu_xyz 3 года назад +1

    JIT has made tailwindcss even better!

  • @telegramvideos1313
    @telegramvideos1313 3 года назад

    I'm commited to learn new tailwind trick every day, this is the trick for today.. Thanks !

  • @mamtaagarwal1009
    @mamtaagarwal1009 3 года назад +1

    Tailwind is just getting better. Let's go

  • @ShezanKazi
    @ShezanKazi 2 месяца назад

    Love the simplicity. ❤

  • @adamtak3128
    @adamtak3128 3 года назад +3

    This is my favorite approach to handling labels and inputs. I'm so happy I don't have to write custom css for it anymore.

  • @io_inc
    @io_inc 7 месяцев назад

    I like this, simple and minimalistic

  • @MrSonicastra
    @MrSonicastra 3 года назад

    Cool Simon, i was looking today for that on RUclips! I'm glad i found it 😁. Lifesaver, thumps up.

  • @modprog
    @modprog 3 года назад

    you can also use a space in the placeholder IIRC

  • @MOGE_
    @MOGE_ 10 месяцев назад

    naaaaaaah I thought i knew tailwind before watching this video. I could literally feel my proverbial tailwind skill bar go up as I watched this.

  • @ayazsheikh6827
    @ayazsheikh6827 3 года назад

    Hope you have recovered from ribs injury.. tha ks for your beautiful work

    • @simonswiss
      @simonswiss 3 года назад +1

      Not quite yet - but this video was recorded just before the accident!

    • @ayazsheikh6827
      @ayazsheikh6827 3 года назад +1

      @@simonswiss wish you speedy recovery!

  • @notfadeaway6617
    @notfadeaway6617 Год назад

    i like these small detail tricks

  • @alfredomontoya4087
    @alfredomontoya4087 2 года назад

    Excellent work and explanation, thank you very much for everything.

  • @mbparvezme
    @mbparvezme 3 года назад +1

    Awesome design by an awesome tool. A suggestion for a little improvement in the terms of UX. Class "cursor-text" for the label would be really good to make a fluent UX feel.

  • @hariniran6360
    @hariniran6360 2 года назад +1

    So I have a silent problem where I can't type if I click directly on the peer-placeholder, please help. If I can anywhere else in the input field and it's fine !

  • @hcsftw
    @hcsftw 3 года назад +1

    Hi Simon, instead of absolute you could have used flex on the div and order on the input and label to fix this.

  • @AntNZ
    @AntNZ 3 года назад +1

    I'm sooooo using this - i had no idea this was possible with css\tailwind. Mind = blown.

  • @jimmyj.6792
    @jimmyj.6792 3 года назад +1

    Holy crap this awesome tip 😍 thanks a lot 😀😀 accessibility power 💪

  • @daretobedangerous6552
    @daretobedangerous6552 2 года назад

    your tutorials are amazing! cheers mate

  • @talgatsaribayev821
    @talgatsaribayev821 3 года назад +15

    why not use display: flex and change order? Other than that thanks. It is always amazing.

    • @ashutoshanand4263
      @ashutoshanand4263 3 года назад

      Had the same thought

    • @rfmiotto
      @rfmiotto 3 года назад +1

      If you ask about the parent div that wraps the input and label tags having a flex col-reverse attribute, I don't think it would fix the problem. This is because the peer will still be listening to the previous sibling in the DOM (that is, in the HTML structure and not necessarily the component you see in the screen).

  • @khaledelhoushi8834
    @khaledelhoushi8834 Год назад

    In 4:14c you were typing "class="absolute left-0 -top-3.5(grey image)text-gray-600 text-sm"". Does this code act like CSS or is it the code in the CSS portion or file affecting the webpage?

  • @JoshKLPA
    @JoshKLPA 2 месяца назад

    Great video! I don't know how to feel about the property names being in cursive.

  • @ShaharHarshuv
    @ShaharHarshuv Год назад +1

    Amazing!

  • @AndreNitschke
    @AndreNitschke 2 года назад +1

    Nice Workflow, but is this with the label after input not a problem for screen-readers?

    • @AndreNitschke
      @AndreNitschke 2 года назад

      aria-labelledby in input field with id from label - should solve this problem. Nice

  • @nick97000
    @nick97000 3 года назад +1

    Lovely video and definitely going to implement this solution. How would you handle autocomplete? When I hover over an autocomplete option, the labels and the filled in values appear on top of each other!

  • @alitonoliveira1700
    @alitonoliveira1700 Год назад

    How to make the label go up as soon as I click on the input? The way you showed it only goes up when I start typing.

  • @cristianpallares7565
    @cristianpallares7565 3 года назад

    Nice! Thanks for the video. Learned something new

  • @DongQian
    @DongQian 3 года назад +3

    I hope tailwindcss can write multiple classes to one pseudo-classes. For example hover:[text-red-500, bg-white, ...] instead of repeat `hover:` again and again, it makes the class name list way too long. I think there are libraries that help with this, but I would like to see it as build-in support. Thanks

    • @thomasfindlay2034
      @thomasfindlay2034 3 года назад

      I asked Adam about it recently, but unfortunately, he said that it's not going to be added.

  • @EkySambora
    @EkySambora 2 года назад

    Great tutorial

  • @beni0208tube
    @beni0208tube 3 года назад +2

    For the label => "pointer-events-none"

  • @mass-im
    @mass-im Год назад

    Great content as always! Tnx!!!
    Is it possible to move the styles into an @layer @apply directive?

  • @ed1nh0
    @ed1nh0 3 года назад

    Wondering if there some attr or prop, or even a behavior I could not use a class for it!

  • @joyontokarmakar5765
    @joyontokarmakar5765 2 года назад +1

    What is the name of your PREVIEW extension??

  • @ObviouslyProgrammer
    @ObviouslyProgrammer Год назад

    Thank you this is so nice!

  • @Sashankyt
    @Sashankyt 3 года назад

    I am not getting the peer-placeholder selector in the tailwind docs. It is sometimes hard to know what is available and what not.

  • @PixelRubble
    @PixelRubble 2 года назад +1

    Fantastic trick for text boxes. Do you have a similar trick for drop downs in order to keep page styling similar?

  • @vigneshwaranrenganathan7743
    @vigneshwaranrenganathan7743 Год назад

    great work, is it possible to bring same effect using and ?

  • @harvanchik
    @harvanchik 3 года назад

    Incredible! Thanks so much!

  • @breezycodes
    @breezycodes 2 года назад +2

    How do you get your classes to stay on different lines?

    • @MOGE_
      @MOGE_ 10 месяцев назад

      press enter

  • @deephousefridays1911
    @deephousefridays1911 3 года назад

    I wish I could add more than one like! Awesome videos!

  • @SusanthCom
    @SusanthCom 2 года назад

    Awsome Video

  • @Sabutofons
    @Sabutofons 3 года назад

    I am using vscode prettier extension but it doesn't format my tailwind classes to use multiline like it did for Simon. Am I missing any settings?

  • @osman3404
    @osman3404 3 года назад

    Omg that’s awesome but i wish that was the default of placeholders to Begin with

  • @mnikk1
    @mnikk1 2 года назад

    Instead of -top-3.5 u can make parent 'flex flex-col-revese' or use order class for positioning

  • @girishnashipudi6933
    @girishnashipudi6933 3 года назад

    Awesome! Thank you.

  • @mdekramulhassanavi1819
    @mdekramulhassanavi1819 2 года назад

    Thank you it's help me a lot.

  • @ayobamijimoh4953
    @ayobamijimoh4953 2 года назад

    awesome, thank you

  • @Nate-gi7no
    @Nate-gi7no 2 года назад

    anyone have a problem with not being able to click through the labels to focus the input? am i doing something wrong?

  • @HassanHajX
    @HassanHajX 3 года назад +1

    How did you do the wavy red lines ? Is it possible to do that with just tailwind ?

  • @tiagotheoliveira
    @tiagotheoliveira 3 года назад

    Always incredible videos and content 👏🏼

  • @ahmadabuaysheh
    @ahmadabuaysheh 3 года назад

    is this available in the documentation?? I tried to search for it but couldn't find it.

  • @aislanarislou
    @aislanarislou 3 года назад

    Now a video teaching how to make a ripple effect into buttons : )

  • @jamesgrubb
    @jamesgrubb 3 года назад

    Thanks great information. I had to add a class for when the form is actually filled in ' .label:not(:empty) {
    @apply -top-5;
    }'

  • @NeerajKumar-mm4rl
    @NeerajKumar-mm4rl 3 года назад

    Simon, which font family you are using in code editor. Subscribed 😀

  • @lucasj.pereira4912
    @lucasj.pereira4912 3 года назад

    Does it work in any browser or only recent versions? Asking because some css options does not work in older browsers

  • @DanielDrummond2k6
    @DanielDrummond2k6 3 года назад

    Do you intend to create courses on Tailwind 3.0 or do you already have one?

  • @kukasn
    @kukasn Год назад

    What of select input anyone help me with that

  • @amirnoorani5017
    @amirnoorani5017 3 года назад

    Best tuts from you

  • @FrederickROS
    @FrederickROS 3 года назад

    Super good content as usual. I hope your ribs are going to cure soon!

  • @__su_man
    @__su_man 3 года назад

    Can anyone tell me, which font is this?

  • @CARUSAR21
    @CARUSAR21 3 года назад

    Just amazing

  • @merictunc
    @merictunc 2 месяца назад

    thank you!

  • @samueljagestedt6479
    @samueljagestedt6479 7 месяцев назад

    seems like a ux problem that the user can't click the placeholder to focus the input.

  • @mohakmaheshwari8756
    @mohakmaheshwari8756 3 года назад

    Peer class is not working anymore plz help.

  • @iamsiddd007
    @iamsiddd007 3 года назад

    When I click label it doesn't work. Is that supposed to happen or did I do something wrong. If anyone knows please let me know.

  • @sebsobseb
    @sebsobseb 3 года назад

    In terms of accessibility, does it matter to have the label after the input?

    • @flanger001
      @flanger001 2 года назад

      So long as the "for" attribute is set correctly it will still be accessible!

  • @nyambe
    @nyambe 3 года назад

    wooo 😘, will be using it

  • @gamingklex9010
    @gamingklex9010 3 года назад

    Are you always making these small templates before the video, or where are you getting these?

  • @mryechkin
    @mryechkin 3 года назад

    That is DOPE! 🤯

  • @LRXAORLOV
    @LRXAORLOV 3 года назад

    This is very cool) how can I improve accessibility for such a solution ?

  • @AmxCsifier
    @AmxCsifier 3 года назад

    Is there a way to regroup the variant classes?

  • @kumardeepam
    @kumardeepam Год назад

    this is so sleek

  • @Zoutzuurtjes
    @Zoutzuurtjes 3 года назад

    What theme are you using?

  • @thanossmponias2915
    @thanossmponias2915 3 года назад

    just amazing . . . .

  • @Habesha_Today
    @Habesha_Today Год назад

    your vscode font?

  • @mansourahmed3841
    @mansourahmed3841 3 года назад

    VS Code Auto-Complete Tailwindcas not working

  • @it-s-me-mohit
    @it-s-me-mohit 3 года назад

    Awesome 👍👍👍

  • @GustavAgar
    @GustavAgar 3 года назад

    excellent 🙌 make more videos please

  • @xidnebwoz
    @xidnebwoz 2 года назад

    Awesome!

  • @codephilip
    @codephilip 3 года назад

    Awesome 😎

  • @mohamedyoussef8835
    @mohamedyoussef8835 Год назад

    Awesome video +++++++++++++++ 🙂

  • @EdzonmxDev
    @EdzonmxDev Год назад

    Hello, Please How are you ?
    Please i can have the name of your VS Code Font...

  • @nuotsu
    @nuotsu 3 года назад

    great approach to floating labels, but i hate how much bloat tailwind adds

  • @karllson
    @karllson 3 года назад

    Awesome job !