# @noxy/react-button

> A simple button react element.

Latest version **1.0.5** (published 2023-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @noxy/react-button
pnpm add @noxy/react-button
yarn add @noxy/react-button
bun add @noxy/react-button
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-03-22 |
| First published | 2022-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | oscelest |
| Maintainers | noxy |

## Links

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

## Dependencies (1)

- [@noxy/react-utils](https://npm.io/package/@noxy/react-utils.md) ^0.1.5

## Recent versions

- 1.0.5 (latest) — 2023-03-22
- 1.0.4 — 2023-03-21
- 1.0.3 — 2023-03-21
- 1.0.2 — 2023-03-12
- 1.0.1 — 2023-02-24
- 1.0.0 — 2023-02-17
- 0.6.4 — 2023-02-17
- 0.6.3 — 2023-02-16
- 0.6.2 — 2023-02-16
- 0.6.1 — 2023-02-16
- 0.6.0 — 2023-02-16
- 0.5.0 — 2023-02-16
- 0.4.0 — 2023-02-16
- 0.3.4 — 2023-02-16
- 0.3.3 — 2023-02-16
- … 5 more at https://npm.io/package/@noxy/react-button/versions

## README

# react-button

## Introduction

`react-button` is a [React](https://reactjs.org/) functional component that creates a button which can be styled and interacted with like a normal button.
It features the normal keyboard and mouse interactability that an HTML button does, but also allows for a value to be return through an `onSubmit` callback.

## Installation

To install run the following command:

```shell
npm install @noxy/react-button@latest
```

Typescript types are already available in the library so no need to get external types.

## Usage

The following is an example of how to use the component:

```typescript jsx
import {Button} from "@noxy/react-button";
import React, {HTMLProps} from "react";

function TestComponent(props: HTMLProps<HTMLDivElement>) {
  const value = {hello: "world"}
  
  return (
    <Button onSubmit={onButtonSubmit} value={value}>
      Click me!
    </Button>
  );
  
  function onButtonSubmit() {
    // Prints '{hello: "world"}'
    console.log(value);
  }
}

```

## Properties

The `DialogInstance` component inherits all HTMLDivElement properties and applies them directly to the outermost element.
This includes the className property for those using CSS modules.

### value: V (any)

The value that will be returned when the onSubmit event is fired.

**Default value**: `undefined`

### onSubmit: callback(value: V): void

An event handler fired when the button is pressed or the button is interacted with by pressing enter or space.
The callback receives the value given to the button.

**Default value**: `undefined`

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