# react-faux-button

> An accessible, configurable React Button usurper.

Latest version **1.0.0** (published 2018-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-faux-button
pnpm add react-faux-button
yarn add react-faux-button
bun add react-faux-button
```

## 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.0.0 |
| Published | 2018-07-25 |
| First published | 2018-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Fotis Papadogeorgopoulos |
| Maintainers | fpapado |
| Keywords | react, a11y, accessibility, button, aria |

## Links

- npm: https://www.npmjs.com/package/react-faux-button
- Repository: https://github.com/fpapado/react-faux-button
- Homepage: https://github.com/fpapado/react-faux-button#readme
- Issues: https://github.com/fpapado/react-faux-button/issues
- npm.io page: https://npm.io/package/react-faux-button

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) ^16.4.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-07-25
- 0.3.0 — 2018-07-12
- 0.2.0 — 2018-07-12

## README

# React Faux Button

> Accessible React `<button>` usurper.

[![npm](https://img.shields.io/npm/v/react-faux-button.svg)](https://www.npmjs.com/package/react-faux-button)
[![gzip size](http://img.badgesize.io/https://unpkg.com/react-faux-button/dist/react-faux-button.js?compression=gzip)](https://unpkg.com/react-faux-button/dist/react-faux-button.js)
[![npm downloads](https://img.shields.io/npm/dm/react-faux-button.svg)](https://www.npmjs.com/package/react-faux-button)

## Table of Contents

* [Features](#features)
* [Install](#install)
* [Motivation](#motivation)
* [Usage](#usage)

## NOTE
Use sparingly. If you can use the default `<button>` – possible more often than not – just do so.
Incidentally, this is the reason the package is called "faux" button :)

## Features

* Accessible defaults.
* Full presentational control for the caller.
* Easy to understand source code. You should be able to fork and do your thing if desired.
* Ample documentation to help you understand the problem, in addition to the solutions.

What it does not do by itself:

* Style things. That is up to you :)

## Install

This package is distributed via [npm](https://www.npmjs.com/get-npm).

```shell
$ npm install --save react-faux-button
# or
$ yarn add react-faux-button
```

Then import according to your modules model and bundler, such as [Rollup](https://rollupjs.org/guide/en) and [Webpack](https://webpack.js.org/):

```js
// ES Modules
import { FauxButton } from "react-faux-button";

/// CommonJS modules
const { FauxButton } = require("react-faux-button");
```

A [UMD](https://github.com/umdjs/umd) version is also available on [unpkg](https://unpkg.com/):

```html
<script src="https://unpkg.com/react-faux-button/dist/react-faux-button.umd.js"></script>
```

## Motivation
When having an interactable item in your application, a `button` is almost always the right answer.
I have found that many developers are averse to using `button` due to its historical styling issues.

While I find the button resets (and more importantly, styling) to be straightforward nowadays, I often have
to work with codebases that use `div`s with an `onClick`. Those codebases might have non-straightforward
resets, might rely on the element being a `div`, and so on. In those cases, I find it particularly useful
to have an accessible `button` usurper. This is the one I use.

## Usage
### Quick Start

If you want to just dive in, do this:

```jsx
import { FauxButton } from "react-faux-button";

<FauxButton tag="div" onInteraction={() => /* do something */}>
  Print files
</FauxButton>
```

## References
The ARIA authoring practices offer a concise overview of expected button behaviour:
- https://www.w3.org/TR/wai-aria-practices-1.1/#button
- https://www.w3.org/TR/wai-aria-practices-1.1/examples/button/button.html

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