React Native progress icons for Brightlayer UI applications
npm install @brightlayer-ui/react-native-progress-icons
![]()
This is a library of icons with dynamic fill capabilities that can be used to show progress (similar to a traditional progress spinner or bar). These can be used to show health, battery life, etc.
Currently, we have icons available for:
- battery
- heart
- pie
- ups
To install the Brightlayer UI progress icons from NPM as a dependency for your project, you can run the following command in your project root:
``sh`
yarn add @brightlayer-ui/react-native-progress-icons
In order to use this library, you must also have react-native-svg installed in your project. You can add it by running:
`sh`
yarn add react-native-svg
If you are using Expo, the Expo client app already includes the necessary native code for react-native-svg.
Install the JavaScript dependency with:
`sh`
npx expo install react-native-svg
See the Expo docs for more information.
The progress icon components can be imported and used like you would use any other component.
`tsx`
import {Battery, Heart, Pie} from '@brightlayer-ui/react-native-progress-icons';
...
These props are available on all of the progress icons in this package.
| Prop Name | Description | Type | Required | Default |
| ---------------- | -------------------------------------- | ------------------------------------------------------------ | -------- | -------- |
| backgroundColor | Background color for the unfilled area | string | no | |string
| color | The color used for the icon fill | | yes | |string
| labelColor | Label text color | | no | |'top'
| labelPosition | Where to display the text label | \| 'bottom' \| 'center' \| 'right' \| 'left' | no | center |number
| labelSize | Size of the label in px | | no | size/4 |boolean
| outlined | Whether to use the outlined style | | no | false |number
| percent | The amount to fill the icon (0-100) | | no | 100 |boolean
| showPercentLabel | Option to show percentage overlay | | no | false |number
| size | The size of the icon (in px) | | no | 24 |
Any other props supplied will be provided to the root element (Svg).
The battery supports all of the shared properties above and the following additional properties:
| Prop Name | Description | Type | Required | Default |
| --------- | -------------------------------------- | --------- | -------- | ------- |
| charging | Whether to show the charging indicator | boolean | no | false |
The pie supports all of the shared properties above and the following additional properties:
| Prop Name | Description | Type | Required | Default |
| --------- | ------------------------------------------------------------------ | -------- | -------- | ------- |
| ring | The thickness of the outer ring (1 = thin ring, 10 = full circle ) | number` | no | 10 |