-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Component: Order and spacing issues for text and icon in Button component #44042
Comments
The It's a tricky set of changes because the component is so widely used across the WordPress ecosystem, and I'm sure in many instances with style overrides. I wonder what the best approach could look like here |
Thinking about it, I'd be tempted to see if we can deprecate all icon-related props on @mirka what do you think? |
@t-hamano I agree with this spec 100% 👍
@ciampo Hard to say without taking better inventory of the current in-app usage, but I imagine the "icon + text" pattern to be common enough that it warrants some kind of designated API, if only for consistent styling. I'm hoping that, by streamlining the existing CSS and providing padding wrappers like we did for Dropdown, we can improve the resizability (important!) and internal composability of Button without making API changes 🤞 |
In my experience, the As shown in the query results on WP Directory, I think many developers seem to use only button text as a children, as shown in the usage examples in the component reference. Ideally, the |
Update: I have confirmed that I think this at least means that we no longer have to worry about padding and margin. |
Description
On
Button
component with the icon, there are perhaps unanticipated issues regarding the order and spacing of text and icon.Button text can be specified with the
text
prop or as a child element, but in that variation I see the following problem:iconPosition
prop is not reflected in the case of child texticonPosition
isright
In my opinion, the expected behavior is as follows:
iconPosition
isright
Is the current behavior expected?
Also, is my expected behavior reasonable?
cc @ciampo @mirka
Step-by-step reproduction instructions
To check the behavior of the current button component, I used the following code in the
core/code
block.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: