# react-style-proptype

> validates style objects by ensuring they only have valid keys

Latest version **3.2.2** (published 2018-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-style-proptype
pnpm add react-style-proptype
yarn add react-style-proptype
bun add react-style-proptype
```

## 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 | 3.2.2 |
| Published | 2018-08-31 |
| First published | 2016-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 84.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | Frankie Bagnardi |
| Maintainers | greenjello |
| Keywords | react, proptype, validation, devtool, style, css |

## Links

- npm: https://www.npmjs.com/package/react-style-proptype
- Repository: https://github.com/brigand/react-style-proptype
- Homepage: https://github.com/brigand/react-style-proptype#readme
- Issues: https://github.com/brigand/react-style-proptype/issues
- npm.io page: https://npm.io/package/react-style-proptype

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.4

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 3.2.2 (latest) — 2018-08-31
- 3.2.1 — 2018-03-08
- 3.2.0 — 2018-02-07
- 3.1.0 — 2017-10-21
- 3.0.0 — 2017-04-08
- 2.0.2 — 2017-03-20
- 2.0.1 — 2017-02-23
- 2.0.0 — 2017-01-26
- 1.4.0 — 2016-11-16
- 1.3.2 — 2016-11-11
- 1.3.1 — 2016-11-11
- 1.3.0 — 2016-11-11
- 1.2.0 — 2016-09-21
- 1.1.2 — 2016-03-31
- 1.1.1 — 2016-03-31
- … 3 more at https://npm.io/package/react-style-proptype/versions

## README

Validates style objects by ensuring the keys are valid css property names (in camelcase form).


```js
var stylePropType = require('react-style-proptype');

var Comp = React.createClass({
  propTypes: {
    myStyle: stylePropType,
  },
  render(){ ... }
});
```

You can use stylePropType.isRequired similar to the built in proptypes.

## Flow

We also expose a flow type definition. It doesn't use an 'exact' type definition due to a bug in flow, so it'll allow invalid properties. The main purpose of this type is to improve the editor experience for custom components that accept a style prop.

```jsx
import { type Style } from 'react-style-proptype/src/Style.flow.js';

type Props = {
  style: Style,
};
```

## Arrays

With react-native styles can be passed an array of objects. You can use this variant with
`stylePropTypes.supportingArrays`.

## Removing in production

While prop-types aren't **executed** in production, they still take up bundle size. This is true of both the official prop-types package and react-style-proptype.

[babel-plugin-transform-react-remove-prop-types](https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types) can be used to completely remove prop-types, including the one from react-style-proptype.

Example .babelrc

```json
{
  "presets": ["env", "react"],
  "plugins": [
    [
      "transform-react-remove-prop-types",
      {
        "removeImport": true,
        "additionalLibraries": ["react-style-proptype"]
      }
    ]
  ]
}
```

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