Components
Data Bars
Components to indicate progress, performance, or status. For example, an individual score compared to a benchmark, the length of a process, or the deviation of a value.
ProgressBar
MarkerBar
DeltaBar
RangeBar
CategoryBar
Tremor exports five components for progress and score bars:
ProgressBar
: Standard progress barMarkerBar
: Bar with marker points to show negative or positive deviation from a particular thresholdDeltaBar
: Bar to show negative or positive deviation from a particular thresholdRangeBar
: Bar to show individual performance against peer performanceCategoryBar
: Bar with categories and individual performance marker
Import Bar Components
Tremor exports five components within the Data Bar category.
import { ProgressBar, MarkerBar, DeltaBar, RangeBar, CategoryBar, } from "@tremor/react";
ProgressBar
The background color of the ProgressBar
automatically adjusts to the selected
color of the color. ProgressBar
allows input from 0
to 100
where 100
means 100 percent. If no data is available or percentageValue equals zero,
the ProgressBar
is not shown and only the background is visible.
ProgressBar
Usage example ProgressBar
Can be combined with several components, such as Flex
and Text
components.
ProgressBar with Text components
$ 9,012 • 45%
$ 20,000
import { Card, Flex, Text, ProgressBar } from "@tremor/react"; export default () => ( <Card className="max-w-sm"> <Flex> <Text>$ 9,012 • 45%</Text> <Text>$ 20,000</Text> </Flex> <ProgressBar percentageValue={45} color="teal" className="mt-3" /> </Card> );
API Reference: ProgressBar
client component
- percentageValue
- Description
- Sets the value of the progress indicator.
- Type
- number
- Default
- Values
- 0 to 100
- labeloptional
- Description
- Sets a value displayed on right side of the bar.
- Type
- string
- Default
- Values
- coloroptional
- Description
- Sets the color of the Bar and the bar background.
- Type
- string
- Default
- blue
- Values
- See color section
- tooltipoptional
- Description
- Set a tooltip on hover.
- Type
- string
- Default
- Values
- showAnimationoptional
- Description
- Sets an animation to the chart when it is loaded.
- Type
- boolean
- Default
- true
- Values
- true, false
MarkerBar
The MarkerBar
allows input from 0
to 100
. If no data is available or
percentageValue equals zero, the marker is not shown and only the background
is visible.
MarkerBar
Usage example MarkerBar
The component can be combined with several components, such as Flex
and Text
components.
MarkerBar with Text components
$ 9,012 • 45%
$ 20,000
import { MarkerBar, Card, Flex, Text } from "@tremor/react"; export default () => ( <Card className="max-w-sm"> <Flex> <Text>$ 9,012 • 45%</Text> <Text>$ 20,000</Text> </Flex> <MarkerBar percentageValue={45} color="fuchsia" className="mt-4" /> </Card> );
API Reference: MarkerBar
client component
- percentageValue
- Description
- Sets the value of the progress indicator.
- Type
- number
- Default
- Values
- 0 to 100
- coloroptional
- Description
- Sets color of the marker.
- Type
- string
- Default
- blue
- Values
- See color section
- tooltipoptional
- Description
- Set a tooltip on hover.
- Type
- string
- Default
- Values
- showAnimationoptional
- Description
- Sets an animation to the chart when it is loaded.
- Type
- boolean
- Default
- true
- Values
- true, false
DeltaBar
Delta bar allows input from 100%
to 100
, where 100 equals 100 percent.
isIncreasePositive can be used to declare positive change as negative and
vice versa, meaning that the bar will be colored red if positive change is seen
as negative. If no data is available or percentageValue equals zero, the
marker is not shown and only the background is visible.
DeltaBar with default increase behavior
DeltaBar with increase seen as negative
Usage example DeltaBar
Can be combined with several components, such as Flex
and Text
components.
DeltaBar with positive increase seen as negative
Product A
+$9,000
(+45%)
import { DeltaBar, Card, Flex, Text } from "@tremor/react"; export default () => ( <Card className="max-w-sm"> <Flex> <Text>Product A</Text> <Flex alignItems="baseline" justifyContent="end" className="space-x-1"> <Text>+$9,000</Text> <Text>(+45%)</Text> </Flex> </Flex> <DeltaBar percentageValue={45} isIncreasePositive={false} className="mt-3" /> </Card> );
API Reference: DeltaBar
client component
- percentageValue
- Description
- Sets the value of the bar.
- Type
- number
- Default
- Values
- 0 to 100
- isIncreasePositiveoptional
- Description
- To indicate whether positive change is positive or negative.
- Type
- boolean
- Default
- true
- Values
- true, false
- tooltipoptional
- Description
- Set a tooltip on hover.
- Type
- string
- Default
- Values
- showAnimationoptional
- Description
- Sets an animation to the chart when it is loaded.
- Type
- boolean
- Default
- true
- Values
- true, false
RangeBar
The RangeBar
allows input from 0
to 100
. If no data is available or
percentageValue equals zero, the marker is not shown and only the background
is visible. The same applies to peer group value, minPercentageValue and
maxPercentageValue.
RangeBar
Usage example RangeBar
Can be combined with several components, such as Flex
and Text
components.
RangeBar
+$9,000 (+45%)
Product A
import { RangeBar, Card, Flex, Text } from "@tremor/react"; export default () => ( <Card className="max-w-sm"> <Flex> <Flex> <Text>+$9,000 (+45%)</Text> <Text>Product A</Text> </Flex> </Flex> <RangeBar percentageValue={39} minPercentageValue={10} maxPercentageValue={30} markerTooltip="39%" rangeTooltip="10% - 30%" className="mt-3" color="rose" /> </Card> );
API Reference: RangeBar
client component
- percentageValue
- Description
- Sets the value of the marker.
- Type
- number
- Default
- Values
- 0 to 100
- minPercentageValueoptional
- Description
- The value that defines the start or minimum value of the peer value range.
- Type
- number
- Default
- Values
- 0
- maxPercentageValueoptional
- Description
- The value that defines the end or maximum value of the peer value.
- Type
- number
- Default
- Values
- markerTooltipoptional
- Description
- Sets a tooltip when hovering over the marker bar.
- Type
- string
- Default
- Values
- rangeTooltipoptional
- Description
- Sets a tooltip when hovering over the range.
- Type
- string
- Default
- Values
- showAnimationoptional
- Description
- Sets an animation to the chart when it is loaded.
- Type
- boolean
- Default
- true
- Values
- true, false
- coloroptional
- Description
- Sets the color of the marker.
- Type
- string
- Default
- blue
- Values
- See color section
CategoryBar
The CategoryBar
allows input from 0
to 100
. If no data is available or
percentageValue equals zero, the marker is not shown and only the bar
categories are visible. The marker's color is automatically adjusted to the
color of the category in which the marker is located.
CategoryBar with four categories
Example usage CategoryBar
Can be combined with several components, such as Flex
and Text
components.
CategoryBar
Rating Product A
62%
import { CategoryBar, Card, Flex, Text } from "@tremor/react"; export default () => ( <Card className="max-w-sm"> <Flex> <Text>Rating Product A</Text> <Text>62%</Text> </Flex> <CategoryBar categoryPercentageValues={[40, 30, 20, 10]} colors={["emerald", "yellow", "orange", "rose"]} percentageValue={62} className="mt-3" /> </Card> );
API Reference: CategoryBar
client component
- categoryPercentageValues
- Description
- Define the percentage values of the bars. Ideally, they sum up to 100
- Type
- array
- Default
- Values
- E.g. [40, 30, 20, 10]
- percentageValueoptional
- Description
- Set the value of the marker.
- Type
- number
- Default
- Values
- 0 to 100
- colorsoptional
- Description
- Change the default colors. When using Typescript, import the Color type provided by tremor.
- Type
- Color[]
- Default
- Values
- E.g. ['blue', 'indigo'].
- showLabelsoptional
- Description
- Display labels above the bars.
- Type
- boolean
- Default
- true
- Values
- true, false
- tooltipoptional
- Description
- Set a tooltip on hover.
- Type
- string
- Default
- Values
- showAnimationoptional
- Description
- Sets an animation to the chart when it is loaded.
- Type
- boolean
- Default
- true
- Values
- true, false