Tremor - React Component Library for Dashboards
repository·main·Indexed Apr 15, 2026
https://github.com/tremorlabs/tremorTremor is a React component library for building dashboards and data visualizations. It offers over 35 accessible, customizable components built on Tailwind CSS and Radix UI. Designed for copy-and-paste usage with minimal configuration, it includes components for charts, calendars, cards, and callouts. Recent updates to components like Accordion, AreaChart, Badge, BarChart, BarList, Button, and Calendar require Tailwind CSS v4.
What's inside tremor
Installation
mainTo get started, refer to the official Installation Guide. The guide covers:
- Prerequisites (Node.js, Tailwind CSS setup).
- Package installation commands.
- Initial configuration steps.
tremorlabs/tremor
mainTremor is a React component library for building dashboards and data visualizations, offering over 35 accessible, customizable components built on Tailwind CSS and Radix UI. It is designed for developers to copy and paste components directly into their applications with minimal configuration.Configure Playwright Test for Tremor Components
mainThe Tremor project uses Playwright for end-to-end testing of its components. The test suite is configured to run against the Storybook server, which serves the component documentation and examples.
Key Configuration Details:
- Test Directory: Tests are located in
./src/components. - Execution Mode: Tests run in parallel (
fullyParallel: true) by default. - CI Behavior: In CI environments, the build fails if
test.onlyis found, retries are set to 2, and workers are limited to 1 to ensure stability. - Reporter: Test results are reported via the HTML reporter.
- Trace Collection: Traces are collected on the first retry to aid debugging.
- Web Server: The test runner automatically starts the Storybook server (
npm run storybook) onhttp://localhost:6006before running tests.
Environment Variables:
CI: When set, enables strict CI behaviors (fail ontest.only, retries, single worker)..env: The configuration supports loading environment variables viadotenv, though it is currently commented out.
Browser Support: Tests run against Chromium, Firefox, and WebKit (Desktop Safari) by default. Mobile and branded browser configurations (Edge, Chrome channel) are commented out but available for uncommenting.
Sources:
playwright.config.ts- Test Directory: Tests are located in
Use the Toast Component
mainThe Toast component displays temporary notifications. It requires a
ToastProviderwrapper and aToastViewportcontainer. The component accepts the following props:title(string): The main title of the toast.description(string): The detailed message.variant(string): The style variant. Options includedefault,warning,error,success, andloading.open(boolean): Controls whether the toast is visible.disableDismiss(boolean): If true, prevents the user from dismissing the toast.action(object): Adds an action button to the toast. Contains:label(string): The button text.altText(string): Accessibility text for the button.onClick(function): The click handler.
Basic Usage:
import { ToastProvider, ToastViewport, Toast } from "@tremor/react"; // Wrap your app or component tree <ToastProvider> <ToastViewport> <Toast title="Information" description="Your account has been successfully created." open={true} variant="success" /> </ToastViewport> </ToastProvider>With an Action Button:
<Toast title="Deployment Successful" description="Your project has been deployed." open={true} variant="success" action={{ label: "Revert", altText: "Revert the deployment", onClick: () => handleRevert(), }} />import { ToastProvider, ToastViewport, Toast } from "@tremor/react"; <ToastProvider> <ToastViewport> <Toast title="Information" description="Your account has been successfully created." open={true} variant="success" /> </ToastViewport> </ToastProvider>Sources:
src/components/Toast/toast.stories.tsxTrigger Toasts Programmatically
mainTo trigger toasts programmatically (e.g., on button clicks), use the
toastfunction from theuseToasthook and include aToastercomponent in your render tree.Steps:
- Import
Toasterfrom@tremor/react. - Place
<Toaster />in your component tree (usually at the root). - Import
toastfrom@tremor/hooks(or the specific hook path). - Call
toast()withtitleanddescriptionoptions.
Example:
import { Toaster } from "@tremor/react"; import { Button } from "@tremor/react"; import { toast } from "@tremor/hooks"; export function MyComponent() { return ( <> <Toaster /> <Button onClick={() => toast({ title: "Info", description: "The quick brown fox jumps over the lazy dog.", }) } > Show Toast </Button> </> ); }import { Toaster } from "@tremor/react"; import { Button } from "@tremor/react"; import { toast } from "@tremor/hooks"; <Toaster /> <Button onClick={() => toast({ title: "Info", description: "The quick brown fox jumps over the lazy dog.", }) } > Show Toast </Button>Sources:
src/components/Toast/toast.stories.tsx- Import
Use DateRangePicker with Presets
mainAdd quick-select presets to the
DateRangePickercomponent by passing apresetsarray. Each preset object must include alabelstring and adateRangeobject withfromandtoDate properties.Example presets include "Today", "Last 7 days", "Last 30 days", "Last 3 months", "Last 6 months", "Month to date", and "Year to date".
import { DateRangePicker } from "@tremor/react" // or your local path const rangePresets = [ { label: "Today", dateRange: { from: new Date(), to: new Date(), }, }, { label: "Last 7 days", dateRange: { from: new Date(new Date().setDate(new Date().getDate() - 7)), to: new Date(), }, }, { label: "Last 30 days", dateRange: { from: new Date(new Date().setDate(new Date().getDate() - 30)), to: new Date(), }, }, ] <DateRangePicker presets={rangePresets} />const rangePresets = [ { label: "Today", dateRange: { from: new Date(), to: new Date(), }, }, { label: "Last 7 days", dateRange: { from: new Date(new Date().setDate(new Date().getDate() - 7)), to: new Date(), }, }, ] <DateRangePicker presets={rangePresets} />Sources:
src/components/DatePicker/daterangepicker.stories.tsxTremor
mainTremor is a library of 35+ customizable, accessible React components designed to help you build dashboards and modern web applications quickly. It is built on top of Tailwind CSS and Radix UI.License
mainTremor is released under the Apache License 2.0.
Sources:
README.mdSet Calendar Locale
mainChange the language and formatting of the Calendar by passing a
localeobject fromdate-fns(or similar library).import { fr } from "date-fns/locale" import { Calendar } from "@tremor/react" <Calendar mode="single" locale={fr} selected={date} onSelect={setDate} />export const Locale: Story = { args: { mode: "single", locale: fr, }, }Sources:
src/components/Calendar/calendar.stories.tsxLocalize DatePicker
mainChange the language and labels of the DatePicker by providing a
localeobject (e.g., fromdate-fns) and customizingtranslationsfor specific strings like 'cancel' and 'apply'. You can also localize preset labels.import { fr } from 'date-fns/locale'; import { DatePicker } from '@tremor/react'; <DatePicker locale={fr} placeholder="Choisissez une date" translations={{ cancel: 'Annuler', apply: 'Applicer' }} presets={[ { label: "Aujourd'hui", date: new Date() }, { label: "Demain", date: new Date(new Date().setDate(new Date().getDate() + 1)) }, ]} />Sources:
src/components/DatePicker/datepicker.stories.tsxDisplay Multiple Months in Calendar
mainDisplay multiple months side-by-side by setting the
numberOfMonthsprop to2(or higher). This works with both single and range modes.<Calendar mode="single" numberOfMonths={2} selected={date} onSelect={setDate} />export const SingleTwoMonth: Story = { args: { mode: "single", numberOfMonths: 2, }, }Sources:
src/components/Calendar/calendar.stories.tsx