Button(Props): Make the icon prop more intuitive and dynamic
See original GitHub issueDescription
The icon
position props come with a huge surface area. The idea is to decrease the APIs surface area by introducing more functionalities.
Proposed Change
Instead of iconRight
and default left position of the icon
, we can introduce a new prop called iconPosition
.
And the usage looks might look something like this ⬇️
iconPosition: = "left" | "right" | "top" | "bottom"
The following functionality can be achieved by using the flex
container for the text and the icon and changing it’s the direction to row | row-reverse | column | column-reverse
to achieve all the possible combinations.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Button Component and Props - Build a web app with React ...
Create a reusable button component and receive React props.
Read more >How To Customize React Components with Props
In this tutorial, you'll create custom components by passing props to your component. Props are arguments that you provide to a JSX element....
Read more >Create a highly reusable button with styled-system and styled ...
Today we are going to create our own cool reusable button component . ... we add styled-system we can create even more...
Read more >Passing icons as props in a consistent way using React
1. Unify your icon API · 2. Build the component that accepts dynamic icons · 3. Passing icons to our new component.
Read more >How to Overload TypeScript React Component Interfaces by ...
This article explains how to create correct, intuitive APIs for React components in TypeScript by using prop values to overload React components.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @pranshuchittora , Can I take this up?
I wonder if it might be simpler to or possible to have button follow the same general pattern as
Card
andListItem
have now. Something like:This leaves greater flexibility and customization for users without having to sacrifice ease of use. And it also helps prevent prop bloat.