Add Variants and Loading to your Button! Build a React Component Library with Tailwind CSS & Next.js

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

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

  • @ethan_mick
    @ethan_mick  Год назад +4

    Keep your Tailwind CSS code hinting with this snippet. Add it to your VS Code `settings.json`:
    "tailwindCSS.experimental.classRegex": [
    ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
    ]
    Sorry, I totally forgot to mention this!! Shame on me, lol.

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

    Another great video, you are bringing a lot of value, can't wait to see the channel grow and grow!
    Thank you!

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

      Thank you! Almost to 1000 subscribers which is very exciting 😊

  • @raivikas200
    @raivikas200 Год назад +4

    Great tutorial, that the thing which I was waiting for 🔥🔥.
    Can you also try to make more components maybe which are more commonly used like input fields, modals alert, toast notification .

    • @ethan_mick
      @ethan_mick  Год назад +3

      Input fields are coming next, for sure. After that I'm going to work my way through and then toss them all into a page where people can browse and grab the code for their apps.

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

      @@ethan_mick Thank you so much for this, Can't wait for your next video now 😁

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

    thank you, at last I got how typescript deals with forwardRef.

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

      Glad I could help! The types get tricky around there for sure.

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

    Great video. For accessibility, I use react-aria and it works fantastic.

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

      Yes!! That's what I'm going to add next video to fix the last few annoyances. It... sometimes feels like overkill, but I seriously haven't created a better component without using React Aria.

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

    Fantastic!!!

  • @ekchills6948
    @ekchills6948 6 месяцев назад

    Please Ethan I'm having issues publishing the package. I bundled with rollup but whenever i install it my styles don't work and i don't get any other props asides the default button one's is there something I'm not doing right?

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

    Hey Ethan huge thanks for all these tutorials!
    Since you do you tutorials with App Directory it would be really useful if you could demonstrate Routing features of App router like parallel routing, intercepting routing and all that staff along with role based access to these routes if possible!
    Anyways, Huge thanks, and love your tutorials!

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

      Thanks, I think I'll end up tackling that as I build full applications and can break it down into smaller videos.

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

    Can you make a tutorial teaching people how to set up an initial style guide for a project based of a Figma design / spec?

    • @ethan_mick
      @ethan_mick  Год назад +2

      Interesting idea! I'm not a huge Figma person, I tend to like to build the designs and iterate in code. I find that when using Figma designers tend to forget all the edge cases that need to be developed.

  • @learner8084
    @learner8084 5 месяцев назад

    Are there specific meaning to Primary / Secondary ?

  • @StevenOrtiz-g5r
    @StevenOrtiz-g5r Год назад

    hello friend, do you have a tutorial on how to create a saaS from scratch with roles in Next.js

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

      Answered on another vid, but I'm working in this direction!

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

    Part 2 is finally here, but doesn't this break Tailwind code hinting 😢

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

      Yes, same thing happened, but one thing we can do is to write the classes in globals.css and the just pass class names in the different variants.
      What do you think??

    • @codernerd7076
      @codernerd7076 Год назад +2

      @Vikas Rai the developer of Tailwind hates the apply thing and it may get removed in some future release so we will need to go back to writing css and naming things if we go that route 🤔

    • @athulgeorge4873
      @athulgeorge4873 Год назад +2

      @coderNerd You can add this to your .vscode/settings.json to add tailwind intellisence for cva:
      "tailwindCSS.experimental.classRegex": [
      ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
      ],

    • @ethan_mick
      @ethan_mick  Год назад +2

      Oh my god I am SO SORRY I forgot to mention this. It's even in my notes!! You can add this to your `settings.json` in VS Code to keep Tailwind Code Hinting:
      "tailwindCSS.experimental.classRegex": [
      ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
      ]

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

      @@codernerd7076 Really, I didn't know about it, thanks for the info.

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

    Obviously American, but there's an accent creeping in here. Secret Brit? :)

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

      ;) That would be a surprise to me too!

  • @athulgeorge4873
    @athulgeorge4873 Год назад +2

    Fantastic video mate, I had no idea that tailwind merge existed and is what was missing in my current components to make using them much easier. If possible I would like to see if you can add additional styling for when a user clicks and holds a button so that the background color changes with tailwind. Similar to how ios handles buttons, this video shows what I am trying to do: ruclips.net/video/ydZSNUbHl_8/видео.html . But the problem is that when using react aria its not a fully TS supported library and I wonder how you would handle multiple refs for a button. Thanks again for your video, definitely deservers more subs.

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

      I love @samselikoff, his video showed me React Aria in the first place. I've found the TypeScript support for React Aria to be very good (It's written in TS). I'll run through and show some of these things in the last video!

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

    No. Show us the code where you use the variants

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

      It looks like this:
      Primary
      Primary
      Primary
      setLoading(!loading)}
      >
      Primary

    • @berringervids
      @berringervids 5 месяцев назад

      @@ethan_mick I added 'variant="secondary"' and it worked for the styling at least, do not have a "size" yet.
      The loading starts on all buttons at the same time, have not given it much love yet, gonna figure it out! :)