Widget

A dashboard container that wraps charts, tables, KPIs, or any content with a consistent surface treatment — secondary background shell with an elevated white content area.

Usage

Tokens Over Time
Input
Output
"use client";

import { Widget } from "@thenamespace/uikit";
import { LineChart } from "@thenamespace/uikit/line-chart";

The Widget component provides a cohesive dashboard container with a surface-secondary outer shell and an elevated bg-surface content area. While it's especially useful for charts, it works with any content — tables, KPIs, metrics, or custom layouts.

Anatomy

Import the Widget component and access all parts using dot notation.

import { Widget } from "@thenamespace/uikit";

<Widget>
  <Widget.Header>
    <Widget.Title />
    <Widget.Description />
  </Widget.Header>
  <Widget.Content />
  <Widget.Footer />
  <Widget.Legend>
    <Widget.LegendItem />
  </Widget.Legend>
</Widget>;

With Bar Chart

Requests Over Time
Requests
"use client";

import { Widget } from "@thenamespace/uikit";
import { BarChart } from "@thenamespace/uikit/bar-chart";

With Line Chart

Traffic Sources
Organic
Paid Ads
"use client";

import { Widget } from "@thenamespace/uikit";
import { LineChart } from "@thenamespace/uikit/line-chart";

With Pie Chart

Browser Usage
Chrome
Safari
Firefox
Edge
"use client";

import { Widget } from "@thenamespace/uikit";
import { PieChart } from "@thenamespace/uikit/pie-chart";

With KPIs

Key MetricsLast 30 days
Total Revenue
$228,451
3.3% last 30d
Bounce Rate
42.3%
5.9% vs last 7d
Active Users
98K
10.9% this month
"use client";

import { Widget } from "@thenamespace/uikit";
import { KPI } from "@thenamespace/uikit/kpi";
import { KPIGroup } from "@thenamespace/uikit/kpi-group";

Combine Widget with KPIGroup for a metrics overview with inline sparklines.

Usage Summary

Usage TypeAmount
Usage TypeAmount
Total API Requests
33.1K
Input Tokens
98.2M
Output Tokens
59M
Total Spend
$149.61
"use client";

import { Widget } from "@thenamespace/uikit";
import { ProgressCircle } from "@thenamespace/uikit/progress-circle";
import { Table } from "@thenamespace/uikit/table";

A table with ProgressCircle indicators inside Widget — no charts involved, just structured data.

With Table

Team Members4 members
NameRoleStatusEmail
Kate MooreCEOActivekate@acme.com
John SmithCTOActivejohn@acme.com
Sara JohnsonCMOOn Leavesara@acme.com
Michael BrownCFOActivemichael@acme.com
"use client";

import { Widget } from "@thenamespace/uikit";
import { Table } from "@thenamespace/uikit/table";

Widget works with non-chart content too. Use variant="secondary" on the Table to remove the default table background and let Widget.Content provide the surface.

Dashboard Grid

Overview
Revenue
$228K 12.5%
Orders
1,234 8.2%
Customers
8,921 3.1%
Conversion
3.2% 0.4%
Revenue 12.5%
Traffic
Organic
Paid
Monthly SalesUnits sold — Jan to Dec 2025
"use client";

import { Widget } from "@thenamespace/uikit";
import { AreaChart } from "@thenamespace/uikit/area-chart";
import { BarChart } from "@thenamespace/uikit/bar-chart";

Multiple Widgets compose naturally into responsive dashboard layouts with consistent visual rhythm.

CSS Classes

Element Classes

  • .widget — Root container with surface-secondary background.
  • .widget__header — Header row with title and legend, spaced between.
  • .widget__title — Primary label text.
  • .widget__description — Secondary descriptive text.
  • .widget__content — Elevated inner area with bg-surface and subtle shadow.
  • .widget__footer — Optional bottom row.
  • .widget__legend — Inline legend container.
  • .widget__legend-item — Single legend entry (dot + label).
  • .widget__legend-item-dot — Color indicator dot.
  • .widget__legend-item-label — Legend text.

API Reference

Widget

The root container. Renders the outer shell with a surface-secondary background.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeWidget content (Header, Content, Footer, etc.).
render(props) => ReactElementCustom render function for polymorphic element support.

Also supports all native div HTML attributes.

Widget.Header

Header row with justify-between layout. Place the title on the left and legend or actions on the right.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeHeader content (Title, Legend, Description, etc.).

Widget.Title

Primary label text rendered as a <span>.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeTitle text.

Widget.Description

Secondary descriptive text rendered as a <span>.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeDescription text.

Widget.Content

The elevated inner area with bg-surface background and subtle shadow. This is where charts, tables, or KPIs go.

PropTypeDefaultDescription
classNamestringAdditional CSS classes. Use p-0 to remove padding for edge-to-edge content like tables.
childrenReactNodeMain content.

Widget.Footer

Optional bottom row for actions or metadata.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeFooter content.

Widget.Legend

Inline legend container. Typically placed inside Widget.Header.

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
childrenReactNodeLegendItem children.

Widget.LegendItem

A single legend entry with a color dot and label.

PropTypeDefaultDescription
colorstringRequired. CSS color for the dot (e.g., "var(--chart-3)").
classNamestringAdditional CSS classes.
childrenReactNodeLabel text.