ChildrenWithIcon / Dev

Install

yarn add @ntds/button

Import

import { Button } from '@ntds/button';

Usage with ref

There are two ways to use refs in this component depending on if you provide a custom tag or not (see the previous section). Use the elementRef-prop for all cases where you do not provide a custom tag. When you do pass a custom tag, simply use the ref directly on the custom component/tag in the render-method as shown in the following example:

👨‍💻 Override the tag of the component

All button components defaults to a <button>-tag. However, it's common to change this to an <a>-tag (anchor-tag) for semantic purposes or use a third party component like the <Link />-component from react-router-dom. In any case, this is accomplished by using the render-prop. Like shown in the code example below. All props -- including the children -- gets past down as an argument, making it easy to spoon-feed props to your custom component.

Props

ButtonLoading

PropType & Description

ChildrenWithIcon

PropType & Description
size
ButtonSizes

Changes the appearance of the button including spacing and text. There are four sizes:

  • Small (sm)
  • Medium (md) (the default)
  • Responsive (responsive)
  • Large (lg)

The responsive size will be the same as the medium/base (md) button on smaller screens and the large (lg) button on bigger screens.

children
ReactNode

Any valid ReactNode(s)

This guide is based on version: 4.8.0