# xylophone-react

> A React based xylophone ready to use out of the box

Latest version **2.0.6** (published 2024-07-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install xylophone-react
pnpm add xylophone-react
yarn add xylophone-react
bun add xylophone-react
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2024-07-07 |
| First published | 2019-05-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 110.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Laura Aubin |
| Maintainers | lauraaubin |
| Keywords | xylophone, react |

## Links

- npm: https://www.npmjs.com/package/xylophone-react
- Repository: https://github.com/LauraAubin/Xylophone
- Homepage: https://github.com/LauraAubin/Xylophone-react
- Issues: https://github.com/LauraAubin/Xylophone/issues
- npm.io page: https://npm.io/package/xylophone-react

## 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

- 2.0.6 (latest) — 2024-07-07
- 2.0.5 — 2024-07-06
- 2.0.4 — 2024-07-06
- 2.0.3 — 2024-07-06
- 2.0.2 — 2024-07-06
- 2.0.1 — 2024-07-06
- 1.0.2 — 2019-08-23
- 1.0.1 — 2019-05-18

## README

# Xylophone
> A React based xylophone ready to use out of the box

<img src="https://github.com/LauraAubin/Xylophone-react/raw/master/Screenshot/Xylophone%20-%2012%20keys.png" />

## Play!

🎶 https://lauraaubin.github.io/xylophone/

## Install

Your app must be using React and ReactDom.

```
$ npm install xylophone-react
```

## Usage

```js
import Xylophone from 'xylophone-react';

return <Xylophone />;
```

## Props

| Prop        | Default   | Values |  Type  | Description |
| ------------ |:---------:| -----:| -----:|  -----:|
| `keyCount`  |    12   | 1 - ∞ | number | The number of keys |
| `colors`  |    [Default color map](https://github.com/LauraAubin/Xylophone-react/blob/master/src/Xylophone/Xylophone.js#L64-L125)   | No limits | {color?: string, colorPressed?: string, background?: string}[] | The color scheme of all keys |
| `shape`  |   shrinking    | `shrinking`, `growing`, `flat` | string | The shape of the whole xylophone |
| `height`  |   200    | 1 - ∞ | number | The height of the smallest key (px) |
| `width`  |   Stretch to fit container   | 1 - ∞ | number | The width of all keys (px) |
 `startingOctave`  |  2  | 1 - ∞ | number | The starting octave of the first key |
  `pressedKey`  |  None  | None | (number) => void | Returns which key was pressed most recently |

<br>

**numberOfKeys**

- 12 colors have been set by default. In order to increase the `numberOfKeys` over 12, you need to create your own custom color scheme.

**colors**

- Pass in a custom color in the form of a hex code or named value.
- `colors` will use the last element to paint all *remaining* keys. For example, the following will paint the first key pink, and all remaining keys teal:

```js
colors={[
  {
    color: 'pink',
    colorPressed: 'grey',
    background: 'salmon'
  },
  {
    color: 'teal'
  }
]}
```

**pressedKey**:

- `pressedKey` allows you to pass in a function which can be used to determine which key was pressed most recently:

```js
const handleKeyPress = (number) => {
  ...
}

...

<Xylophone
  pressedKey={handleKeyPress}
/>
```

## Develop

Changes should *only* be made within the `./components` folder. The ES5 folder is the *compiled* equivalent. ES5 compiles Sass to CSS:

```
yarn compile-files
```

Install package locally via:

```
npm install path/to/this/folder
```

## Feedback

Feel free to open an issue with feedback or a feature request. All are welcome 🤗!

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