5.0.0 • Published 11 months ago

@times-tooling/button v5.0.0

Weekly downloads
68
License
BSD-3-Clause
Repository
-
Last release
11 months ago

Button

A collection of different buttons

Install

yarn add @times-tooling/button

Usage

import Button from '@times-tooling/button';

<Button />

<Button onClick={doAction} size="large" inverted={true}>
  Click me
</Button>
<Button onClick={doAction} buttonStyle="secondary" icon="coffee">
  Order coffee
</Button>

Props

onClick

Fired when the user clicks the button

(event: React.ClickEvent<HTMLButtonElement>) => void

type

Button type

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type

buttonStyle

Visual style for the button

  • primary (default)
  • secondary
  • tertiary
  • textOnly
  • back
  • close
  • create
  • icon
  • iconBorder
  • iconCircle
  • cancel

size

Physical size of the button

  • small (default)
  • large

inverted (Boolean, default: false)

Reverse the colours

selected (Boolean, default: false)

Highlight the button

disabled (Boolean, default: false)

Deactivate the button

icon

The font-awesome icon name

Note: when using font-awesome, you'll need to set up a library of icons in your app, as follows:

import { library } from '@fortawesome/fontawesome-svg-core';
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';

library.add(faPencilAlt);

...

<Button icon="pencil-alt" />

You can also pass in a specific icon like this:

import { library } from '@fortawesome/fontawesome-svg-core';
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';

...

<Button icon={faPencilAlt} />

Note: This package includes scss files!

Currently the scss files are not transpiled or bundled. They are only copied from src to lib. In your consuming app you will need to tell Webpack to handle these files by adding the @times-tooling repos to your scss loader. For example:

{
  test: /\.scss$/,
  include: [
      path.resolve(__dirname, 'node_modules/@times-tooling/'),
  ],
  use: [
      'style-loader',
      'css-loader?modules&localIdentName=[path][name]__[local]--[hash:base64:5]',
      'sass-loader',
  ]
}
5.0.0

11 months ago

4.0.1

3 years ago

4.0.0

3 years ago

3.4.5

3 years ago

3.4.3

3 years ago

3.4.2

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.3

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago