CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-tremor--react

Tremor React is a comprehensive React component library built on Tailwind CSS providing 60+ components for building data visualizations, charts, and analytical dashboards.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

Tremor React

React component library built on Tailwind CSS with 60+ components for data visualizations, charts, and analytical dashboards.

Package: @tremor/react v3.18.7 | Install: npm install @tremor/react Peer Deps: react ^18.0.0, react-dom >=16.6.0

Quick Start

import { Card, Title, BarChart } from '@tremor/react';

const data = [
  { name: 'Jan', sales: 2890 },
  { name: 'Feb', sales: 2756 },
];

<Card>
  <Title>Sales</Title>
  <BarChart
    data={data}
    index="name"
    categories={['sales']}
    colors={['blue']}
    valueFormatter={(v) => `$${v.toLocaleString()}`}
  />
</Card>

Component Selector

Use this quick reference to find the right component:

NeedComponentCategory
Display chart dataAreaChart, BarChart, LineChart, DonutChart, ScatterChart, FunnelChartCharts
Show rankings/comparisonsBarListVisualization
Display progressProgressBar, ProgressCircleVisualization
Show distributionCategoryBar, DeltaBar, MarkerBarVisualization
Timeline statusTrackerVisualization
Container/cardCard, DialogLayout
Grid/flex layoutGrid, Flex, ColLayout
Collapsible sectionsAccordionLayout
Text inputTextInput, NumberInput, Textarea, SearchSelectInput
SelectionSelect, MultiSelect, DatePicker, DateRangePickerInput
ActionsButton, Tabs, SwitchInput
TypographyTitle, Subtitle, Text, Metric, CalloutText
Status/labelsBadge, BadgeDelta, IconIcon
Data tablesTable, TableHead, TableBody, ListList
Inline chartsSparkLineChart, SparkAreaChart, SparkBarChartCharts

Core Imports & Types

// All components export from main package
import {
  // Charts
  AreaChart, BarChart, LineChart, DonutChart, ScatterChart, FunnelChart,
  SparkLineChart, SparkAreaChart, SparkBarChart,

  // Layout
  Card, Flex, Grid, Col, Divider, Dialog, DialogPanel, Accordion,
  AccordionList, AccordionHeader, AccordionBody,

  // Visualization
  BarList, ProgressBar, ProgressCircle, CategoryBar, DeltaBar, MarkerBar, Tracker,

  // Input
  Button, TextInput, NumberInput, Textarea, Switch,
  Select, SelectItem, MultiSelect, MultiSelectItem,
  SearchSelect, SearchSelectItem, DatePicker, DateRangePicker, DateRangePickerItem,
  TabGroup, TabList, Tab, TabPanels, TabPanel,

  // Text
  Title, Subtitle, Text, Metric, Bold, Italic, Callout, Legend,

  // Icon
  Icon, Badge, BadgeDelta,

  // List
  List, ListItem, Table, TableHead, TableBody, TableFoot, TableRow,
  TableHeaderCell, TableCell, TableFooterCell,

  // Types
  type Color, type Size, type ValueFormatter, type CurveType, type DeltaType,
  type EventProps, type CustomTooltipProps, type ButtonVariant, type IconVariant,

  // Utils
  getIsBaseColor,
} from '@tremor/react';

// CommonJS also supported
const { AreaChart, Card } = require('@tremor/react');

Important Types - See common-props.md for complete type definitions.

Component Categories

<a name="charts"></a>Charts

Full-featured charts built on Recharts. All share BaseChartProps.

ComponentUse CaseKey Props
AreaChartTrends, cumulative valuesstack, curveType, showGradient, connectNulls
BarChartComparisons across categorieslayout: "vertical"|"horizontal", stack, relative
LineChartTrends over timecurveType, connectNulls
DonutChartCategorical proportionsvariant: "donut"|"pie", label, showLabel
ScatterChartMulti-dimensional relationshipsx, y, category, size, sizeRange
FunnelChartConversion rates, pipelinesvariant: "base"|"center", calculateFrom, evolutionGradient

Spark Charts (compact versions): SparkLineChart, SparkAreaChart, SparkBarChart - same props but minimal chrome.

Detailed Chart Documentation

<a name="visualization"></a>Visualization

Specialized data display components.

ComponentPurposeKey Props
BarListRankings, sorted comparisonsdata, sortOrder, valueFormatter
ProgressBarLinear progress 0-100value, color, showAnimation
ProgressCircleCircular progressvalue, size, children (center content)
CategoryBar100% stacked distributionvalues, colors, markerValue
DeltaBar+/- change visualizationvalue, isIncreasePositive
MarkerBarProgress with targetvalue, minValue, maxValue
TrackerTimeline status blocksdata: {color, tooltip}[]

Detailed Visualization Documentation

<a name="layout"></a>Layout

Container and structure components.

ComponentPurposeKey Props
CardContent containerdecoration, decorationColor
FlexFlexbox layoutflexDirection, justifyContent, alignItems
GridResponsive gridnumItems, numItemsSm/Md/Lg
ColGrid columnnumColSpan, numColSpanSm/Md/Lg
DividerVisual separatorchildren (optional label)
DialogModal overlayopen, onClose, static, unmount
AccordionCollapsible sectionsdefaultOpen

Detailed Layout Documentation

<a name="input"></a>Input

Form controls and interactive elements.

ComponentPurposeKey Props
ButtonActionsvariant, loading, icon, iconPosition
TextInputSingle-line textvalue, onValueChange, error, errorMessage
NumberInputNumeric inputenableStepper, step, min, max
TextareaMulti-line textautoHeight
SwitchTogglechecked, onChange
SelectDropdown (+ SelectItem)enableClear, requires <SelectItem> children
MultiSelectMulti-select (+ MultiSelectItem)placeholderSearch
SearchSelectSearchable select (+ SearchSelectItem)searchValue, onSearchValueChange
DatePickerDate selectionminDate, maxDate, locale, weekStartsOn
DateRangePickerDate range (+ DateRangePickerItem)enableSelect, custom presets
TabGroupTab navigationindex, onIndexChange, use with TabList/TabPanels

All inputs support: error, errorMessage, disabled, placeholder

Detailed Input Documentation

<a name="text"></a>Text

Typography components.

ComponentPurposeProps
TitleMain headingcolor
SubtitleSecondary headingcolor
TextBody textcolor
MetricLarge numbers/KPIscolor
Bold / ItalicText styling wrappers-
CalloutHighlighted noticetitle (required), icon, color
LegendChart legendcategories, colors, onClickLegendItem, enableLegendSlider

Detailed Text Documentation

<a name="icon"></a>Icon

Visual indicators and badges.

ComponentPurposeKey Props
IconIcon wrappericon (required), variant, size, color
BadgeStatus labelscolor, size, icon
BadgeDeltaChange indicatorsdeltaType, isIncreasePositive

Detailed Icon Documentation

<a name="list"></a>List

Tables and lists with semantic HTML.

ComponentPurpose
List / ListItemVertical lists with dividers
Table / TableHead / TableBody / TableFootData tables
TableRow / TableHeaderCell / TableCell / TableFooterCellTable structure

Detailed List Documentation

Design System

Color Palette: 22 theme colors supporting light/dark modes Sizing: xs | sm | md | lg | xl Theme: Automatic light/dark mode via Tailwind

Complete Type Definitions | Common Props Reference

Common Patterns

Dashboard Layout

<div className="p-6 space-y-6">
  <Flex justifyContent="between" alignItems="center">
    <Title>Dashboard</Title>
    <Button>Export</Button>
  </Flex>

  <Grid numItems={1} numItemsSm={2} numItemsLg={4} className="gap-6">
    <Card decoration="left" decorationColor="blue">
      <Text>Revenue</Text>
      <Metric>$45,231</Metric>
      <BadgeDelta deltaType="increase">+12%</BadgeDelta>
    </Card>
    {/* More cards... */}
  </Grid>
</div>

Form with Validation

const [value, setValue] = useState('');
const [error, setError] = useState('');

<TextInput
  value={value}
  onValueChange={(v) => {
    setValue(v);
    setError(v ? '' : 'Required');
  }}
  error={!!error}
  errorMessage={error}
/>

Interactive Chart

const [selected, setSelected] = useState<string | null>(null);

<BarChart
  data={data}
  index="date"
  categories={['revenue']}
  onValueChange={(v) => setSelected(v?.categoryClicked || null)}
/>

Best Practices

  1. Always use valueFormatter for consistent number formatting
  2. Use Tremor palette colors for light/dark mode consistency
  3. Provide meaningful ARIA labels for accessibility
  4. Use startEndOnly for large datasets to reduce axis labels
  5. Controlled vs uncontrolled: Use value/onChange (controlled) or defaultValue (uncontrolled)

Common Mistakes

  • ❌ Forgetting SelectItem children for Select component
  • ❌ Not handling null in chart onValueChange
  • ❌ Using non-Tremor colors without testing dark mode
  • ❌ Forgetting index prop on charts (required)
  • ❌ Not providing enableClear for Select when clearing is needed

Type Safety

import { type Color, type Size, type ValueFormatter } from '@tremor/react';

// Type-safe props
const chartColor: Color = 'blue'; // ✓
const customFormatter: ValueFormatter = (v) => `$${v}`; // ✓

Performance Tips

  • Use startEndOnly for charts with many data points
  • Enable showAnimation: false (default) for better performance
  • Implement virtualization for large tables (use external library)
  • Use React.memo for metric cards that don't change frequently

docs

chart-elements.md

common-props.md

icon-elements.md

index.md

input-elements.md

layout-elements.md

list-elements.md

text-elements.md

types.md

visualization-elements.md

tile.json