Skip to content

Latest commit

 

History

History
90 lines (65 loc) · 3.31 KB

enter-animation-scale.md

File metadata and controls

90 lines (65 loc) · 3.31 KB

Enter Animation Scale

Utilities for controlling the starting scale of enter animations.

Class Properties
zoom-in --tw-enter-scale: 0;
zoom-in-0 --tw-enter-scale: 0;
zoom-in-50 --tw-enter-scale: .5;
zoom-in-90 --tw-enter-scale: .9;
zoom-in-95 --tw-enter-scale: .95;
zoom-in-100 --tw-enter-scale: 1;
zoom-in-105 --tw-enter-scale: 1.05;
zoom-in-110 --tw-enter-scale: 1.1;
zoom-in-125 --tw-enter-scale: 1.25;
zoom-in-150 --tw-enter-scale: 1.5;

Basic Usage

Changing enter animation starting scale

Set the starting scale of an animation using the zoom-in-{amount} utilities.

<button class="animate-in zoom-in ...">Button A</button>
<button class="animate-in zoom-in-50 ...">Button B</button>
<button class="animate-in zoom-in-75 ...">Button C</button>
<button class="animate-in zoom-in-95 ...">Button C</button>

Applying Conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:zoom-in-50 to only apply the zoom-in-50 utility on hover.

<div class="animate-bounce zoom-in-75 hover:zoom-in-50">
	<!-- ... -->
</div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:zoom-in-50 to apply the zoom-in-50 utility at only medium screen sizes and above.

<div class="animate-bounce zoom-in-75 md:zoom-in-50">
	<!-- ... -->
</div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.

Using custom values

Customizing your theme

By default, Tailwind makes the entire default scale available as animation scales. You can customize your scale by editing theme.scale or theme.extend.scale in your tailwind.config.js file.

// @filename tailwind.config.js
module.exports = {
	theme: {
		extend: {
			scale: {
				175: "1.75",
			},
		},
	},
}

Alternatively, you can customize just your animation scales by editing theme.animationScale or theme.extend.animationScale in your tailwind.config.js file.

Learn more about customizing the default theme in the theme customization documentation.

Arbitrary values

If you need to use a one-off animation scale value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

<div class="zoom-in-[1.75]">
	<!-- ... -->
</div>

Learn more about arbitrary value support in the arbitrary values documentation.