# @easyfeedback/buttons

> A collection of default buttons.

Latest version **1.3.0** (published 2021-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @easyfeedback/buttons
pnpm add @easyfeedback/buttons
yarn add @easyfeedback/buttons
bun add @easyfeedback/buttons
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2021-07-05 |
| First published | 2021-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 46.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Alexander Böhm |
| Maintainers | mheob |
| Keywords | easyfeedback |

## Links

- npm: https://www.npmjs.com/package/@easyfeedback/buttons
- Repository: https://github.com/easyfeedback/RCL
- Homepage: https://github.com/easyfeedback/RCL/tree/main/packages/buttons#readme
- Issues: https://github.com/easyfeedback/RCL/issues
- npm.io page: https://npm.io/package/@easyfeedback/buttons

## Dependencies (2)

- [react-icons](https://npm.io/package/react-icons.md) ^4.2.0
- [@easyfeedback/theme](https://npm.io/package/@easyfeedback/theme.md) ^1.2.0

## Recent versions

- 1.3.0 (latest) — 2021-07-05
- 1.2.5 — 2021-06-21
- 1.2.4 — 2021-06-21
- 1.2.3 — 2021-06-18
- 1.2.2 — 2021-06-18
- 1.2.1 — 2021-06-17
- 1.2.0 — 2021-06-16
- 1.1.1 — 2021-06-04
- 1.1.0 — 2021-06-04

## README

# Buttons

Buttons are used as triggers for actions. They are used in forms, toolbars, dialog footers and as
stand-alone action triggers.

## Table of Contents <!-- omit in toc -->

- [Installation](#installation)
- [IconButton](#iconbutton)
- [MenuButton](#menubutton)

## Installation

```sh
yarn add @easyfeedback/buttons
# or
npm i @easyfeedback/buttons
```

## IconButton

`IconButton` composes the Button component except that it renders only an icon.

Since `IconButton` only renders an icon, you must pass the ariaLabel prop, so screen readers can
give meaning to the `button`.

### Import component

```tsx
import { IconButton } from '@easyfeedback/buttons'
```

### General usage

```tsx
<IconButton ariaLabel="Add new item" />
```

### Icon Sizes

Use the `size` prop to change the width and height of the button. You can set the value to `sm` or
`lg`.

```jsx
<VStack>
  <IconButton ariaLabel="Add new item" size="sm" />
  <IconButton ariaLabel="Submit the form" size="lg" />
</VStack>
```

### Icon Variants

Use the `variant` prop to change the icon inside the button. You can set the value to `add` or
`plane`.

```jsx
<VStack>
  <IconButton ariaLabel="Add new item" variant="add" />
  <IconButton ariaLabel="Submit the form" variant="plane" />
</VStack>
```

### Props

| Name      | Description                              | type                                   | Default |
| --------- | ---------------------------------------- | -------------------------------------- | ------- |
| ariaLabel | A11y: A label that describes the button. | `string`                               | -       |
| size      | The size of the button.                  | `'sm' \| 'lg'`                         | `lg`    |
| variant   | The icon variant to render.              | `'add' \| 'plane'`                     | `add`   |
| onClick   | _[Optional]_                             | `MouseEventHandler<HTMLButtonElement>` | -       |

## MenuButton

An accessible dropdown menu for the common dropdown menu button design pattern. `Menu` uses roving
`tabIndex` for focus management.

This special `Menu` is set with the `IoEllipsisVertical` icon.

### Import component

```tsx
import { MenuButton } from '@easyfeedback/buttons'
```

### Usage

```tsx
const myMenuItems: [
  { icon: IoDuplicateOutline, title: 'Duplicate' },
  { icon: IoMove, title: 'Move' },
  { icon: IoPricetagOutline, title: 'Assign tags' },
  { icon: IoPencil, title: 'Save as template' },
  { icon: IoTrashBinOutline, title: 'Delete', color: 'red.500' },
]

<MenuButton menuItems={myMenuItems} />

// Optional there you can change the color of the navigation icon
<MenuButton menuItems={myMenuItems} color="red.500" />

// Or the size of the icon
<MenuButton menuItems={myMenuItems} fonSize="lg" />
```

### Props

| Name      | Description                                              | type                   | Default |
| --------- | -------------------------------------------------------- | ---------------------- | ------- |
| menuItems | The list of menu items.                                  | `MenuListItem[]`       | -       |
| color     | _[Optional]_ The color of the `IoEllipsisVertical` icon. | `string`               | -       |
| fontSize  | _[Optional]_ The size of the `IoEllipsisVertical` icon.  | `'sm' \| 'md' \| 'lg'` | `md`    |

---
_Source: https://npm.io/package/@easyfeedback/buttons · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
