tailwindlabs / tailwindui-issues

Bug fixes and feature request tracking for Tailwind UI.
233 stars 4 forks source link

Catalyst: Button with no href prop doesn't render icons properly #1610

Closed 1Ghasthunter1 closed 2 months ago

1Ghasthunter1 commented 2 months ago

What component (if applicable)

Describe the bug A clear and concise description of what the bug is.

When a Button component has an href prop, rendering an icon per the tailwindUI docs works as expected.

However, with no href component, the icon has no styling applied to it, and the inline (or flex) properties that show the icon side-by-side with the text seem to vanish.

Exhibit A: Works as expected

<Button color="green" href="/">
  Button Text
  <CheckCircleIcon />
</Button>
Screenshot 2024-07-08 at 11 17 33 AM

Exhibit B: does NOT work as expected

<Button color="green">
  Button Text
  <CheckCircleIcon />
</Button>
Screenshot 2024-07-08 at 11 17 51 AM

To Reproduce Steps to reproduce the behavior:

  1. Take the above exhibit(s) and paste them into a project configured properly for Catalyst (e.g. latest tailwind, framer, etc)
  2. Observe the rendered buttons and their differences

Expected behavior A clear and concise description of what you expected to happen.

There should be no difference between the visual appearance of these two components, besides that one is an a element, and the other is a button element

Screenshots If applicable, add screenshots to help explain your problem.

Included above

Browser/Device (if applicable)

Additional Context It seems the issue stems from the LoadingWrapper component -- props are not passed to the parent component of children, whereas with TouchTarget a fragment is used to ensure that children also receive the parent props that is responsible for styling and aligning the icon.

1Ghasthunter1 commented 2 months ago

Never mind -- going to sound stupid but I added a LoadingWrapper component 3 weeks ago and completely forgot. If i get it working properly I'll make a comment on it if others want to use it.