How to build an Animated Button with React Aria and Framer Motion

Ойын-сауық

Learn how to make better buttons for your websites on both mobile and desktop using the React Aria and Framer Motion libraries.
🚀 Demo: codesandbox.io/s/github/samse...
🧑‍💻 Code: github.com/samselikoff/2022-0...
🪄 Framer Motion course: samselikoff.com/framer-motion...
📚 Building a Button blog post, from React Aria: react-spectrum.adobe.com/blog...
📖 React Aria useButton docs: react-spectrum.adobe.com/reac...
📖 Framer Motion useAnimation docs: www.framer.com/docs/use-anima...
- 0:00 - Intro
- 2:28 - Fixing text selection
- 3:07 - Fixing scroll
- 3:42 - Problems with HTML buttons
- 6:30 - Using the Press event from React Aria's useButton
- 11:50 - Fixing the keyboard focus ring
- 14:29 - Animating on press with Framer Motion
- 18:40 - Fixing the isPressed feedback
- 23:31 - Making the tap highlight color transparent
- 24:36 - Final refactoring
- 26:47 - Final demo
- 27:55 - Outro

Пікірлер: 47

  • @igrb
    @igrb2 жыл бұрын

    the sheer amount of good patterns I learn from your vides is unreal, thanks so much for making such amazing content

  • @producergiorgio
    @producergiorgio2 жыл бұрын

    This channel satisfies my developer OCD, thank you Sam 🔥 React Aria is a great library

  • @joshbaker5566
    @joshbaker55662 жыл бұрын

    High-Quality content, per usual! Best-in-class, Sam! I'm starting my new job this next week, and the company's technical interview quizzed me on ARIA attributes, so it's cool to see how seamless you've integrated our favorite technologies! Commenting for the algorithm ;) Cheers, boss!

  • @samselikoff

    @samselikoff

    2 жыл бұрын

    Haha thanks Josh, best of luck at the new digs! 👊

  • @maharaj1991
    @maharaj19912 жыл бұрын

    I get excited every time you post a new vid! wooohoo! thank you for your hard work!

  • @voinbobar
    @voinbobar2 жыл бұрын

    I was worried you stopped making videos, I really like your content. Please keep them coming!

  • @samselikoff

    @samselikoff

    2 жыл бұрын

    Just needed a little break during summer, it's so nice in nyc right now :)

  • @EvertJunior
    @EvertJunior2 жыл бұрын

    Really incredible content as usual. I love your attention to detail, it’s an inspiration for me.

  • @rchuhk100
    @rchuhk100 Жыл бұрын

    Thank you so much for this tutorial! Look forward to your next ones for Framer-motion

  • @ota-ke
    @ota-ke Жыл бұрын

    I'm working on a keypad feature and this is literal gold! Thanks so much Sam.

  • @MrSgtwo
    @MrSgtwo Жыл бұрын

    I'm glad I discovered your channel, lots of valuable information! Keep up the great work :)

  • @jonathangardn
    @jonathangardn Жыл бұрын

    The quality of your videos is really top notch Sam, always best practices and best results bound together.

  • @ariburaco
    @ariburaco2 жыл бұрын

    The quality of your videos is absolutely amazing. I think you deserve a lot more subscribers. Greate job!

  • @mryechkin
    @mryechkin2 жыл бұрын

    React Aria is awesome! Been using it for awhile now, we use it in our design system component library at work as well. Great video as always!

  • @DioArsya
    @DioArsya Жыл бұрын

    Your contents are always amazing, thanks!

  • @SamedGaming
    @SamedGaming2 жыл бұрын

    Nothing better than tutorial from Sam!

  • @erwin7427
    @erwin74272 жыл бұрын

    As usual, top content!

  • @ExplicitPanic
    @ExplicitPanic2 жыл бұрын

    Your channel is slowly becoming my favorite dev related channel! 👍

  • @alsherifkhalaf7385
    @alsherifkhalaf73852 жыл бұрын

    Your topics are great 👍👍👍

  • @Troy-ol5fk
    @Troy-ol5fk2 жыл бұрын

    Different space and enter behavior is pretty funny

  • @_parassolanki
    @_parassolanki2 жыл бұрын

    Thanks you just give me inspiration to add some animation on my project where i have similar functionality.

  • @kiyov09
    @kiyov092 жыл бұрын

    Very cool! 💪

  • @labhamjain3915
    @labhamjain3915 Жыл бұрын

    Awesome channel :)

  • @arjundureja
    @arjundureja2 жыл бұрын

    Wow, it feels just like native iOS button, good job!

  • @ftnsco
    @ftnsco2 жыл бұрын

    Attention to details man, I love it. You must be my brother from another mother! 😅

  • @paynecodes
    @paynecodes Жыл бұрын

    The TypeScript types between react-aria and framer-motion are incompatible. I'd love to see your "one button to rule them all" implementation (unless ofc you're ignore TypeScript ;)

  • @claus4tw
    @claus4tw2 жыл бұрын

    Dope

  • @100timezcooler
    @100timezcooler Жыл бұрын

    unfortunately in my case, i can prevent the button text from highlighting but my iphone instead just highlights the nearest text element on long press

  • @xorlop
    @xorlop Жыл бұрын

    wowowowowow, I was putting off implementing much of this covered for my own app and I am just so happy to see someone who is thinking about the same things as me!

  • @user-vd3ph6zh8q
    @user-vd3ph6zh8q2 ай бұрын

    how would you handle the activation of other buttons when sliding around?

  • @abhim6380
    @abhim63802 жыл бұрын

    Can you please make a range picker using React aria.

  • @ghouston2712
    @ghouston27122 жыл бұрын

    Is there a reason your'e using let instead of const? Lines 34-36? never seen let used using hooks, would be good to know going forward!

  • @wfl-junior
    @wfl-junior Жыл бұрын

    Does that button work perfectly for form submit buttons?

  • @rexfong964
    @rexfong964 Жыл бұрын

    wow

  • @veedjohnson
    @veedjohnson Жыл бұрын

    Pls what extension are you using to to see the CSS style of a tailwind class?

  • @samselikoff

    @samselikoff

    Жыл бұрын

    The official Tailwind CSS IntelliSense extension! marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss

  • @veedjohnson

    @veedjohnson

    Жыл бұрын

    @@samselikoff thanks a lot

  • @FergusMeiklejohn
    @FergusMeiklejohn Жыл бұрын

    What are you using to simulate running the app on a mobile device? thanks

  • @samselikoff

    @samselikoff

    Жыл бұрын

    The Simulator from Xcode! Open Xcode, then in the menu bar click Xcode > Open Developer Tool > Simulator. Check out the first tip from this video if you want to watch me open it up: kzread.info/dash/bejne/fa6qrZppadXSY7Q.html

  • @FergusMeiklejohn

    @FergusMeiklejohn

    Жыл бұрын

    @@samselikoff brilliant thanks! that whole video is so useful 🥳

  • @EvertJunior
    @EvertJunior2 жыл бұрын

    May I ask which vscode theme you use?

  • @samselikoff

    @samselikoff

    2 жыл бұрын

    Yep it's Atom One Dark!

  • @panteliselef239
    @panteliselef239 Жыл бұрын

    Love the content, but I would argue that bringing framer-motion for simple animation adds a 40KB bundle size overhead that is not justifiable when you just want a button

  • @2ezpz2plzme
    @2ezpz2plzme2 жыл бұрын

    10:14 If you keep the `active:[757376]`, even though there are consistencies between browsers, that may still work on some browsers before JavaScript is loaded.

  • @Happyday-nn6rh
    @Happyday-nn6rh Жыл бұрын

    Really incredible content as usual. I love your attention to detail, it’s an inspiration for me.

Келесі