New features for the button component
See original GitHub issueSummary
Currently I have to do a ton of work to make the Button
component work properly in enterprise applications. For example, I need to do the following for virtually all buttons:
- Fix focusIndicator persistence issue.
- Display a loading spinner when loading={true}.
- Handle onClick vs React Router navigation in a graceful way.
All these things combined amounts to a ton of wrapping of this button component. By the time I’m done wrapping it, I have to ask myself: Why am I still using this Button component in the first place?
It would be great if the <Button/>
included support for these two additional props:
- Loading state. Example: replace label or icon with small loading spinner.
- First class React Router support (I think this used to be included, but was removed)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Building a button component - web.dev
The <button> element is built for user interaction. Its click event triggers from keyboard, mouse, touch, voice, and more, with smart rules ...
Read more >Buttons - Material Design
New buttons have updated shape, typography, and color mappings, dynamic color compatibility, and 3 additional types (elevated, filled, and filled tonal)— ...
Read more >React Button Examples
Using styled-components, we can create our own React button component and style it with css inside the template tag. If you're not familiar...
Read more >The Button element - HTML: HyperText Markup Language
The <button> HTML element is an interactive element activated by a user with a mouse, keyboard, finger, voice command, or other assistive ...
Read more >Button Component | Adobe Experience Manager
The Core Component Button component allows for the inclusion of a button on a page. The button's properties can be selected in the...
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
Just to chip in on how I’ve used the button component in a Gatsby project.
I needed to change the Button style to show the active menu item within my nav, unfortunately the
isPartiallyActive
method suggested by @reach/router here didn’t work for me when nested the Button component within a Link component.So I came up with this, which works nicely:
Implementation:
A set of Link components for React Router and Reach Router / Gatsby Would be awesome!
Hey again,
So we spend some time thinking about this button loading feature and we are a bit unsure whether adding it is a good idea. We definetely see some value in it but we have are hesitating for the following reasons:
Generally we not saying a blunt no, we are open for discussion but trying to be extra carefull before adding more props to the API interface!
Thanks once again for you ideas and contribution to the community 😃