Skip to content

How to create native fade in animation with utility classes on render/mount/page load #2094

Answered by philippbosch
bennettdams asked this question in Help
Discussion options

You must be logged in to vote

You won't be able to build this with native utility classes alone I think. But did you see the new animation feature in 1.6?

You could put something like this in your tailwind.config.js:

module.exports = {
  theme: {
    extend: {
      animation: {
        'fade-in': 'fade-in 1s ease',
      },
      keyframes: {
        'fade-in': {
          from: { opacity: 0 },
          to: { opacity: 1 },
        },
      },
    },
  },
};

Then you can change your code to:

<div className="error animate-fade-in">Some error</div>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bennettdams
Comment options

Answer selected by bennettdams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants