2.2.6 • Published 4 years ago

react-donut-component v2.2.6

Weekly downloads
69
License
MIT
Repository
github
Last release
4 years ago

downloads MIT License npm

Install

npm install react-donut-component

Usage

Try it out in the browser

import React from 'react'
import { Donut } from 'react-donut-component' 

const App = () => (  
  <Donut>70</Donut>
);

Preview:

donut-example

Setting a label:

When you put a label, you have to specify the value with DonutValue component

import React from 'react'
import { Donut, DonutValue, DonutLabel } from 'react-donut-component' 

const App = () => ( 70 My label );

#### Preview: 
![donut-example](https://i.ibb.co/wwbBkQw/image.png)

<hr />

### Styling: 
> There are many style props with the format 'styleSomething'.

[See API](https://5f711adb6ec1620022e842dc-wucwtrunim.chromatic.com/?path=/story/donut--simple-donut)
```jsx
import React from 'react'
import { Donut, DonutValue, DonutLabel } from 'react-donut-component' 

const App = () => (
  <Donut
    styleTrack={{ strokeWidth: 9, stroke: 'AliceBlue' }}
    styleIndicator={{ stroke: 'Cyan', strokeLinecap: 'round' }}
  >
    <DonutValue
      style={{ fontWeight: 'bold' }}
      symbol='°C'
      styleSymbol={{ fontWeight: 'bold', fontSize: '18px' }}
      symbolPosition='top-right'
    >
      79
    </DonutValue>
  </Donut>
);

Preview:

donut-example

Usage with multiple values

We provide a component called DonutMultiple, which can receive multiple DonutElement values that are calculated relatively.

import React from 'react'
import { DonutMultiple, DonutElement, DonutLabel } from 'react-donut-component' 

const App = () => (
  <DonutMultiple>
    <DonutElement color='brown' name="Messi">6</DonutElement>
    <DonutElement color='black' name="CR7">5</DonutElement>
    <DonutLabel>Ballon d'ors</DonutLabel>
  </DonutMultiple>
);

Preview:

donut-example

See the API and more examples like this in the: the story book

That's all :wink:

Contributors

@gsdeveloper

LICENSE

MIT

2.2.6

4 years ago

2.2.5

4 years ago

2.2.3

4 years ago

2.2.4

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago