title: Adding transition to sibiling of animated element in flexbox
body: <p>I wish to reveal the button label on hovering over the button container smoothly.</p>
  <p>I have a flexbox container with two elements, namely icon and label. The width property of the label is animated from 0 -&gt; 100% over hover on the container. The issue is I'm unable to add a transition to the icon to move it smoothly when the label's width is adjusted. And so the icon's animation looks snappy.</p>
  <p>In the below example, hovering over the icon reveals it's label. But the icon themselves don't transition smoothly, rather they snap to places. Adding <code>transition: all 0.2s;</code> to icon doesn't seem to have any effect.</p>
  <p>Could someone please say what I'm missing here? Or is there a better way to implement this? TIA.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
  }
  
  .tile {
    margin: 2rem;
    height: 100%;
    border-radius: 0.5rem;
    padding: 1rem;
    width: 30rem;
  }
  
  .header-wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between;
    margin: 0;
    flex-wrap: wrap;
  }
  
  .title-wrapper {
    display: inline-flex;
  }
  
  .title-wrapper.title {
    margin: 0 0.25rem;
    font-weight: 600;
  }
  
  .header-button-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
  }
  
  .header-button {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    color: #50585c;
    fill: #50585c;
    background-color: transparent;
    min-height: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    margin: 0;
    border: none;
    border-radius: 0.4rem;
    outline: none;
    cursor: pointer;
    overflow: hidden;
  }
  
  .header-button--icon {
    padding: 0;
    margin: 0;
    width: 1em;
    font-size: 1.2em;
    font-weight: 600;
  }
  
  .header-button--label {
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: width 0.2s ease-out, margin 0.2s ease-out;
    margin: 0;
    width: 0;
    white-space: nowrap;
    overflow: hidden;
  }
  
  .header-button:hover {
    background-color: #f6f7f7;
  }
  
  .header-button:hover &gt; [class$='--label'] {
    margin: 0 0 0 0.4em;
    width: 100%;
  }
  
  .header-button:active {
    color: #2c3133;
    background-color: #c5cacc;
    box-shadow: 0px 4px 10px rgb(0 0 0 / 3%), 0px 0px 2px rgb(0 0 0 / 6%),
      0px 2px 6px rgb(0 0 0 / 12%);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdn.jsdelivr.net/npm/primeflex@3.2.1/primeflex.min.css" rel="stylesheet"/&gt;
  &lt;link href="https://cdn.jsdelivr.net/npm/primeicons@5.0.0/primeicons.css" rel="stylesheet"/&gt;
  &lt;link rel="preconnect" href="https://fonts.googleapis.com"&gt;
  &lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&gt;
  &lt;link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&amp;display=swap" rel="stylesheet"&gt;
  
  &lt;div class="tile shadow-2"&gt;
    &lt;div class="header-wrapper"&gt;
      &lt;div class="title-wrapper title"&gt;
        Article Title
      &lt;/div&gt;
      &lt;div class="header-button-container"&gt;
        &lt;div class="header-button"&gt;
          &lt;i class="pi pi-plus-circle header-button--icon"&gt;&lt;/i&gt;
          &lt;div class="header-button--label"&gt;
            &lt;span&gt;Add details&lt;/span&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="header-button"&gt;
          &lt;i class="pi pi-download header-button--icon"&gt;&lt;/i&gt;
          &lt;div class="header-button--label"&gt;
            &lt;span&gt;Download article&lt;/span&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>