### Define Getting Started Steps Data (TypeScript)
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-02.mdx
This TypeScript array defines the structured data for each step in a user onboarding or setup flow. Each object contains an `id`, `title`, `description`, and `status` ('complete' or 'open'), which are used to dynamically render the progress list in the UI.
```TypeScript
const steps = [
{
"id": "1.",
"title": "Set up your organization",
"description":
"You successfully created your account. You can edit your account details anytime.",
"status": "complete"
},
{
"id": "2.",
"title": "Connect to data source",
"description":
"The platform supports more than 50 databases and data warehouses.",
"status": "open"
},
{
"id": "3.",
"title": "Create metrics",
"description": "Create metrics using custom SQL or our intuitive query mask.",
"status": "open"
},
{
"id": "4.",
"title": "Create report",
"description":
"Transform metrics into visualizations and arrange them visually.",
"status": "open"
}
];
```
--------------------------------
### React Getting Started Progress Flow Component
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-03.mdx
This TSX component renders a 'Getting Started' section, guiding users through a series of predefined steps. It utilizes a `ProgressBar` component to visually indicate overall progress and displays individual steps with their status (complete or open), descriptions, and clickable links. Completed steps are marked with a checkmark icon, while open steps show their numerical ID. It also includes a contact section for support.
```tsx
// 'use client';
import { RiCheckboxCircleFill } from '@remixicon/react';
import { ProgressBar } from '@/components/ProgressBar';
const steps = [
//array-start
{
id: '1.',
title: 'Set up your organization',
description:
'You successfully created your account. You can edit your account details anytime.',
status: 'complete',
href: '#',
},
{
id: '2.',
title: 'Connect to data source',
description:
'The platform supports more than 50 databases and data warehouses.',
status: 'open',
href: '#',
},
{
id: '3.',
title: 'Create metrics',
description: 'Create metrics using custom SQL or our intuitive query mask.',
status: 'open',
href: '#',
},
{
id: '4.',
title: 'Create report',
description:
'Transform metrics into visualizations and arrange them visually.',
status: 'open',
href: '#',
},
//array-end
];
export default function Example() {
return (
<>
Getting started
Follow the steps to set up your workspace. This allows you to create
your first dashboard.
>
);
}
```
--------------------------------
### React Component for Multi-Step Getting Started UI (TSX)
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-02.mdx
This React functional component (`Example`) renders a user interface for a multi-step 'getting started' process. It iterates over the `steps` array (defined elsewhere), displaying each step's title and description, and dynamically shows a completion icon or step number based on its status. The component also includes basic navigation buttons and uses Tremor Blocks components for styling.
```TSX
// 'use client';
import { RiCheckboxCircleFill } from '@remixicon/react';
import { Button } from '@/components/Button';
// const steps = [...] // This array is defined separately but used here.
export default function Example() {
return (
<>
Getting started
Follow the steps to set up your workspace. This allows you to create
your first dashboard.
>
);
}
```
--------------------------------
### Render Dynamic Onboarding Accordion Component in TSX
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-04.mdx
This snippet defines the main `Example` React component, which renders the "Getting Started" UI. It imports necessary icons and Tremor components, then iterates over the `steps` array. For each step, it conditionally renders an `AccordionItem` with different styling and content based on the `step.status`. This includes displaying a checkmark for 'complete' steps and a circular placeholder for 'current' steps, along with relevant descriptions and a disabled button.
```tsx
// 'use client';
import {
RiCalculatorLine,
RiCheckboxCircleFill,
RiDatabase2Line,
RiFileChartLine,
RiSoundModuleLine,
} from '@remixicon/react';
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from '@/components/Accordion';
import { Button } from '@/components/Button';
const steps = [
//array-start
{
title: 'Sign up and create workspace',
subtitle: 'Account created',
icon: RiSoundModuleLine,
description:
'You successfully created your account. Edit your account details anytime.',
buttonText: 'Edit account',
status: 'complete',
},
{
title: 'Connect to data source',
subtitle: 'Create connection',
icon: RiDatabase2Line,
description:
'Connect to a data source. The platform supports more than 50 databases.',
buttonText: 'Connect data source',
status: 'current',
},
{
title: 'Create metrics',
subtitle: 'Create a metric',
icon: RiCalculatorLine,
description: 'Create metrics using custom SQL or our intuitive query mask.',
buttonText: 'Create metric',
status: 'upcoming',
},
{
title: 'Create report',
subtitle: 'Create a report',
icon: RiFileChartLine,
description:
'Transform metrics into visualizations and arrange them visually with our report builder.',
buttonText: 'Create report',
status: 'upcoming',
},
//array-end
];
export default function Example() {
return (
<>
{/* Additional span wrapper for icon to align it with icons in other accordions */}
{step.title}
{/* custom color used to optimize this edge case */}
{step.subtitle}
{step.description}
) : step.status === 'current' ? (
{step.title}
```
--------------------------------
### Render Dynamic Setup Wizard Steps (React/TypeScript)
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-01.mdx
This React functional component (`Example`) renders a list of setup steps dynamically based on their 'type' property. It uses conditional rendering to display different UI elements (icons, buttons) for 'done', 'in progress', and 'open' steps, providing a visual representation of the user's progress through a setup flow. It integrates with Remixicon for icons and a custom Button component.
```tsx
// 'use client';
import {
RiCheckboxBlankCircleLine,
RiCheckboxCircleFill,
RiDatabase2Line,
} from '@remixicon/react';
import { Button } from '@/components/Button';
const steps = [
{
id: 1,
type: 'done',
title: 'Sign in with your account',
description:
'To get started, log in with your organization account from your company.',
href: '#',
},
{
id: 2,
type: 'in progress',
title: 'Import data',
description:
'Connect your database to the new workspace by using one of 20+ database connectors.',
href: '#',
},
{
id: 3,
type: 'open',
title: 'Create your first report',
description:
'Generate your first report by using our pre-built templates or easy-to-use report builder.',
href: '#',
}
];
export default function Example() {
return (
<>
>
);
}
```
--------------------------------
### Define Onboarding Steps Data Structure in TSX
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-04.mdx
This snippet defines the `steps` array, a crucial data structure for the "Getting Started" component. Each object in the array represents a distinct step in the onboarding process, containing properties like `title`, `subtitle`, `icon` (a Remixicon component), `description`, `buttonText`, and `status`. The `status` property (`complete`, `current`, `upcoming`) dictates how each step is rendered in the UI.
```tsx
const steps = [
//array-start
{
title: 'Sign up and create workspace',
subtitle: 'Account created',
icon: RiSoundModuleLine,
description:
'You successfully created your account. Edit your account details anytime.',
buttonText: 'Edit account',
status: 'complete',
},
{
title: 'Connect to data source',
subtitle: 'Create connection',
icon: RiDatabase2Line,
description:
'Connect to a data source. The platform supports more than 50 databases.',
buttonText: 'Connect data source',
status: 'current',
},
{
title: 'Create metrics',
subtitle: 'Create a metric',
icon: RiCalculatorLine,
description: 'Create metrics using custom SQL or our intuitive query mask.',
buttonText: 'Create metric',
status: 'upcoming',
},
{
title: 'Create report',
subtitle: 'Create a report',
icon: RiFileChartLine,
description:
'Transform metrics into visualizations and arrange them visually with our report builder.',
buttonText: 'Create report',
status: 'upcoming',
},
//array-end
];
```
--------------------------------
### React Component for Workspace Setup Progress UI
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-07.mdx
A React functional component, `Example`, that renders a comprehensive user interface for tracking and displaying workspace setup progress. It utilizes `Card` and `Tabs` components to organize 'Updates' (progress steps) and 'Details' sections. The component dynamically renders step status using icons and conditional styling, and includes a call-to-action button.
```TSX
export default function Example() {
return (
<>
```
--------------------------------
### Define Setup Wizard Steps Data (TypeScript)
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-01.mdx
This TypeScript array defines the data structure for a multi-step setup wizard. Each object represents a step with properties like 'id', 'type' (status), 'title', 'description', and 'href' for navigation. This data drives the dynamic rendering of the wizard's progress.
```typescript
const steps = [
{
id: 1,
type: 'done',
title: 'Sign in with your account',
description:
'To get started, log in with your organization account from your company.',
href: '#',
},
{
id: 2,
type: 'in progress',
title: 'Import data',
description:
'Connect your database to the new workspace by using one of 20+ database connectors.',
href: '#',
},
{
id: 3,
type: 'open',
title: 'Create your first report',
description:
'Generate your first report by using our pre-built templates or easy-to-use report builder.',
href: '#',
}
];
```
--------------------------------
### React Example Page with Tremor UI Components
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/page-shells/page-shell-01.mdx
This comprehensive React component (`Example`) demonstrates a typical dashboard-like page structure. It utilizes Tremor UI components like `Card`, `Select`, and `Tabs` for layout and interaction. A helper component, `ContentPlaceholder`, is included to visually represent content areas. The example showcases responsive design using Tailwind CSS classes and basic state management for select and tab selections.
```tsx
// 'use client';
import { Card } from '@/components/Card';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/Select';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/Tabs';
function ContentPlaceholder() {
return (
);
}
export default function Example() {
return (
<>
Report
OverviewDetail
>
);
}
```
--------------------------------
### Define Workspace Setup Progress Steps Data
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-07.mdx
An array of objects, `steps`, defining the sequential stages of a workspace setup process. Each object includes properties such as `id`, `type` (e.g., 'done', 'in progress', 'open'), `title`, `description`, and `activityTime`, which are used to render a progress timeline.
```TypeScript
const steps = [
{
id: 1,
type: 'done',
title: 'Created Workspace',
description:
'You successfully created your first workspace in privacy mode',
activityTime: '3d ago',
},
{
id: 2,
type: 'done',
title: 'Connected database',
description: 'Database connected to MySQL test database',
activityTime: '2d ago',
},
{
id: 3,
type: 'done',
title: 'Add payment method',
description: 'Payment method for monthly billing added',
activityTime: '31min ago',
},
{
id: 4,
type: 'in progress',
title: 'Audit trails',
description: 'Identifying security issues or unauthorized policy settings',
activityTime: 'Running now...',
},
{
id: 5,
type: 'open',
title: 'Invite team members',
description: 'Add team members to workspace',
activityTime: 'Upcoming',
},
];
```
--------------------------------
### React Component for Dashboard Onboarding Flow
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/banners/banner-05.mdx
This React component (`Example`) implements a multi-step onboarding guide for creating a dashboard. It displays a `Card` containing steps for connecting data, adding metrics, and creating reports, with dynamic content sourced from an internal data array. The component includes state management for visibility and a demo-specific effect to re-open the card after closing.
```tsx
import React from 'react';
import { RiCloseLine } from '@remixicon/react';
import { Button } from '@/components/Button';
import { Card } from '@/components/Card';
const data = [
//array-start
{
step: 1,
title: 'Connect data',
description: 'Bring your existing data source or create a new one.',
buttonText: 'Add data',
disabled: false,
tooltipText: '',
},
{
step: 2,
title: 'Add metrics',
description:
'Create metrics using custom SQL or with our aggregation mask.',
buttonText: 'Add metric',
disabled: true,
tooltipText: 'Connect to a data source first',
},
{
step: 3,
title: 'Create report',
description:
'Transform metrics into visualizations and add layout elements.',
buttonText: 'Create report',
disabled: true,
tooltipText: 'Create metrics first',
},
//array-end
];
export default function Example() {
const [isOpen, setIsOpen] = React.useState(true);
// just for demo purposes
React.useEffect(() => {
if (!isOpen) {
const timeoutId: NodeJS.Timeout = setTimeout(() => {
setIsOpen(true);
}, 1000);
return () => clearTimeout(timeoutId);
}
}, [isOpen]);
return isOpen ? (
<>
Create your first dashboard
Set up your first dashboard. Connect to a data source, create metrics
and visualize them in the report builder.
{data.map((item) => (
Step {item.step}
{item.title}
{item.description}
))}
>
) : null;
}
```
--------------------------------
### Define Workspace Setup Progress Steps Data
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/onboarding-feed/onboarding-feed-08.mdx
This array defines the structured data for each step in the workspace setup process. Each object contains an ID, type (e.g., 'done', 'in progress', 'open'), a descriptive title, a detailed description, and a timestamp for activity. This data drives the progress timeline displayed in the UI.
```typescript
const steps = [
{
"id": 1,
"type": "done",
"title": "Created Workspace",
"description": "You successfully created your first workspace in privacy mode",
"activityTime": "3d ago"
},
{
"id": 2,
"type": "done",
"title": "Connected database",
"description": "Database connected to MySQL test database",
"activityTime": "2d ago"
},
{
"id": 3,
"type": "done",
"title": "Add payment method",
"description": "Payment method for monthly billing added",
"activityTime": "31min ago"
},
{
"id": 4,
"type": "in progress",
"title": "Audit trails",
"description": "Identifying security issues or unauthorized policy settings",
"activityTime": "Running now..."
},
{
"id": 5,
"type": "open",
"title": "Invite team members",
"description": "Add team members to workspace",
"activityTime": "Upcoming"
}
];
```
--------------------------------
### Demonstrate Bar Chart with Custom Tooltip and Toggle
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/chart-tooltips/chart-tooltip-17.mdx
The main example component that orchestrates the BarChart demonstration. It includes a toggle button to show/hide the chart, a preview of the custom tooltip, and two BarChart instances (one for small screens, one for larger screens) using the defined data and custom tooltip. This setup illustrates responsive chart rendering and interactive display.
```tsx
export default function Example() {
const [showDemo, setShowDemo] = React.useState(false);
return (
<>
{showDemo ? (
<>
>
) : null}
>
);
}
```
--------------------------------
### Main Dashboard Example Component Structure
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/chart-compositions/chart-composition-10.mdx
This is the main 'Example' React component, serving as the entry point for the dashboard UI. It utilizes the 'useState' hook to manage local component state, such as 'showContent', and renders a flexible layout that includes dynamically mapped summary statistics, demonstrating how various UI elements are composed.
```tsx
export default function Example() {
const [showContent, setShowContent] = React.useState(true);
return (
<>
{summary.map((item, index) => (
{item.name}
{item.value}
{index < summary.length - 1 && (
{/* Demo */}
{showDemo ? (
<>
>
) : null}
>
);
}
```
--------------------------------
### React Example Component Demonstrating Tremor UI Elements
Source: https://github.com/tremorlabs/tremor-blocks/blob/main/src/content/markdown/chart-tooltips/chart-tooltip-20.mdx
This React functional component, `Example`, showcases the integration and usage of several Tremor UI components including `CustomTooltip`, `Divider`, `Button`, and `BarChart`. It manages a `showDemo` state to toggle the visibility of two responsive `BarChart` instances and demonstrates passing complex data structures as props to these components.
```TypeScript
export default function Example() {
const [showDemo, setShowDemo] = React.useState(false);
return (
<>