question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add additional prop for button and fab that accept other elements like `a`

See original GitHub issue

For now, button and fab render fixed <button> element. However, button like components is usually used with <a> element or another react components as well.

For example, when I want to use react-router’s Link component with @material/react-button, it should be possible (component, tag prop name is just example):

<Button component={Link} to="/home">button</Button>

// or

<Button tag="a" href="/somewhere">button</Button>

It’s not possible, now.

If it’s an acceptable feature request, I can make a pr.

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
moog16commented, Jul 25, 2018

@wesleyabbey Ya I like that. Care to open PR?

1reaction
wesleyabbeycommented, Jul 25, 2018

What about having an href prop that, when passed in, turned the button into an <a/> tag?

    const SemanticButton = href ? 'a' : 'button';
    return (
      <SemanticButton
        className={classes}
        ref={initRipple}
        {...otherProps}
      >
        {icon ? this.renderIcon() : null}
        {children}
      </SemanticButton>
    );
Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a floating action button (FAB) component - web.dev
A foundational overview of how to build color-adaptive, responsive, and accessible FAB components.
Read more >
How to extend props for Material-UI components using ...
The following button uses the Link component. It allso uses the Link's specific props with their types. It allso adds its own sesific...
Read more >
Add a Floating Action Button - Android Developers
A floating action button (FAB) is a circular button that triggers the primary action in your app's UI. This page shows you how...
Read more >
React Floating Action Button (FAB) component - Material UI
A floating action button appears in front of all screen content, typically as a circular shape with an icon in its center. FABs...
Read more >
Buttons: floating action button - Material Design
A FAB represents the primary action on a screen. Constructive. A FAB should perform a constructive action (such as create, share, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found