Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename data-from -> data-closed and data-exit -> data-leave #3285

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Jun 12, 2024

This PR updates the newly exposed data attributes introduced in #3273

After playing with them in real projects, we improved the naming for a few reasons:

  1. If you are describing the "from" state and if it's different for enter and exit then you would have to type:

    <div
      class="data-[enter]:data-[from]:-translate-x-full data-[exit]:data-[from]:-translate-x-full"
    ></div>

    And data-[exit]:data-[from] reads like you are transitioning from a certain state, but you are transitioning to that state.

  2. If you use leave instead of exit then it will be consistent with the properties that we already have on the Transition component. Additionally, the length is the same now so they align better.

    <div
      className={clsx(
        "data-[enter]:data-[closed]:-transition-x-full",
        "data-[exit]:data-[closed]:transition-x-full",
      )}
    />

    vs

    <div
      className={clsx(
        "data-[enter]:data-[closed]:-transition-x-full",
        "data-[leave]:data-[closed]:transition-x-full",
      )}
    />

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 11:50am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 11:50am

@RobinMalfait RobinMalfait merged commit 2092049 into main Jun 12, 2024
8 checks passed
@RobinMalfait RobinMalfait deleted the feat/change-data-attribute-names branch June 12, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant