Fireship · @fireship
Advanced Dropdown Menu - React & CSS Animation Tutorial for Beginners
Uploaded April 17, 2020 · Length 16:52
Summary
Create a multi-level animated dropdown menu using React and CSS animation for beginners.
- react
- css animation
- dropdown menu
- beginner tutorial
- ui design
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
I don't log into Facebook often but the
- 0:01
last time I did I was super impressed by
- 0:03
its simple intuitive and fast new UI in
- 0:06
today's video I'll show you how to
- 0:07
reverse engineer some of its UI features
- 0:09
specifically the top navigation bar is
- 0:12
icon buttons and this multi-level
- 0:13
animated drop-down will do it using HTML
- 0:16
CSS and because I mentioned the word
- 0:18
Facebook I'm legally obligated to use
- 0:20
react in this demo in the following code
- 0:22
tutorial you'll learn how to create icon
- 0:24
buttons with flexbox you'll learn how to
- 0:25
use CSS transforms to create sliding
- 0:28
animations and fundamental concepts in
- 0:30
react white component composition hooks
- 0:32
and how to create CSS animations based
- 0:34
on the state of your react application
- 0:36
and I'll throw in a bunch of other cool
- 0:37
tips along the way if you're new here
- 0:39
like and subscribe and let me know if
- 0:41
you want to see more beginner friendly
- 0:42
UI tutorials like this in the comments
- 0:44
before we get started let's take a
- 0:46
closer look at what we're building today
- 0:47
by the end of this video
- 0:48
you'll have several reusable react
- 0:50
components that you can use for
- 0:51
navigation and drop downs at the top we
- 0:53
have a navbar component where the
- 0:55
children are nav items represented at
- 0:57
icon buttons these buttons have children
- 0:59
that you can toggle on or off by
- 1:01
clicking them when we click the carrot
- 1:02
it renders our drop down component it
- 1:04
contains multiple drop down items and
- 1:06
the ones with a chevron can toggle to a
- 1:08
secondary drop down menu notice how the
- 1:10
hold menu slides out to the left and the
- 1:12
new one comes in from the right and
- 1:13
because the height of the two menus
- 1:15
won't be the same we'll animate that as
- 1:16
well now before we get started I'd just
- 1:18
like to say this is a beginner friendly
- 1:19
video but we move at a very fast pace on
- 1:22
this channel so feel free to pause the
- 1:23
video or slow down the playback speed as
- 1:25
you follow along the first thing we'll
- 1:27
need is a react app assuming you have no
- 1:29
js' installed open up the command line
- 1:30
and run npx create react app and of
- 1:33
course the name of our app is Facebook
- 1:35
to keep this demo simple I'm going to
- 1:37
delete everything that's not the index
- 1:39
JSF KS or index dot CSS files the
- 1:42
index.js file is your initial entry
- 1:44
point I'll go ahead and remove the
- 1:45
serviceworker stuff here then you can
- 1:47
ignore this file for the rest of the
- 1:48
video from there I'm removing all the
- 1:50
boilerplate code from the app.js file
- 1:52
will be using functional react
- 1:54
components in this video when you see a
- 1:55
function whose name starts with a
- 1:57
capital letter you can think of that as
- 1:58
a component the return value of a


