> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# transition

APISummary
## Introduction

The transition CSS property is a shorthand property for `transition-property`, `transition-duration`, `transition-timing-function`, and `transition-delay`.

## Example

**This is an example below: css-api**

**Entry:** `src/transition`
**Bundle:** `dist/transition.lynx.bundle`

```tsx
import { root, useState } from "@lynx-js/react";
import "./index.scss";

const Transition = () => {
  const [flag, setFlag] = useState(false);

  const baseStyle = {
    opacity: flag ? "1" : "0.1" as const,
    width: flag ? "100px" : "200px",
    height: flag ? "100px" : "200px",
    backgroundColor: flag ? "blue" : "red",
    visibility: (flag ? "visible" : "hidden") as "visible" | "hidden",
    top: flag ? "0px" : "50px",
    right: flag ? "0px" : "50px",
    bottom: flag ? "0px" : "50px",
    left: flag ? "0px" : "50px",
    transform: flag ? "translateX(0px)" : "translateX(50px)" as const,
  };

  return (
    <scroll-view scroll-orientation="vertical" className="scroll">
      <view className="base" bindtap={() => setFlag(!flag)}>
        <text>Click to transition</text>
      </view>
      <view className="base opacityTransition" style={{ opacity: baseStyle.opacity }}>
        <text>opacity animation</text>
      </view>
      <view className="base widthTransition" style={{ width: baseStyle.width }}>
        <text>width animation</text>
      </view>
      <view className="base heightTransition" style={{ height: baseStyle.height }}>
        <text>height animation</text>
      </view>
      <view className="base bgColorTransition" style={{ backgroundColor: baseStyle.backgroundColor }}>
        <text>background-color animation</text>
      </view>
      <view className="base transformTransition" style={{ transform: baseStyle.transform }}>
        <text>transform animation</text>
      </view>
    </scroll-view>
  );
};

root.render(<Transition />);

```

v0.11.0



## Syntax

```css
/* Apply to 1 property */
/* property name | duration */
transition: background-color 4s;

/* property name | duration | delay */
transition: opacity 4s 1s;

/* property name | duration | easing function */
transition: background-color 4s ease-in-out;

/* property name | duration | easing function | delay */
transition: background-color 4s ease-in-out 1s;

/* Apply to 2 properties */
transition:
  background-color 4s,
  opacity 4s;

/* Apply to all changed properties */
transition: all 0.5s ease-out;

/* Clear all transition animation.*/
transition: none;
```

## Formal definition

| Initial value | empty value |
| Applies to | all elements |
| Inherited | no |
| Animatable | no |


## Formal syntax

```css
transition: <transition-property> || <transition-duration> ||
  <transition-timing-function> || <transition-delay>;
```

## Transition Event

- [Transition Event](/next/api/lynx-api/event/animation-event.md)

## More

- [transition-property](/next/api/css/properties/transition-property.md)
- [transition-duration](/next/api/css/properties/transition-duration.md)
- [transition-delay](/next/api/css/properties/transition-delay.md)
- [transition-timing-function](/next/api/css/properties/transition-timing-function.md)
- [Animation Event](/next/api/lynx-api/event/animation-event.md)

## Notes

:::info

- Only the properties listed in [transition-property](/next/api/css/properties/transition-property.md) are supported.

:::

## Compatibility

**Compatibility Table**

**Query:** `css.properties.transition`

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/109-transition.json) · [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/transition)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| transition | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`transition`**

**Specifications:**

