Search documentation

Search for a page or component.

Period Tabs

A small segmented control for switching a chart between week, month, and year.

Showing: month
"use client"

import * as React from "react"

A small segmented control for switching a chart or card between periods like week, month, and year. It is a thin layer over shadcn's Tabs, with an optional animated pill.

Installation

pnpm dlx shadcn@latest add @dashboardcn/period-tabs

Also installs tabs from shadcn/ui if missing.

Usage

import { PeriodTabs } from "@/components/ui/period-tabs"

const [period, setPeriod] = React.useState("month")

<PeriodTabs value={period} onValueChange={setPeriod} />

Examples

Animated

Set animated to slide a single pill between tabs instead of swapping backgrounds.

Showing: month
"use client"

import * as React from "react"