Updated
Tear-off Tabs
NewCustomize
Height360px
Threshold36px
Installation
npx shadcn@latest add https://uibrik.com/r/tear-off-tabs.jsonInstall the packages
npm install @tabler/icons-react motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/tear-off-tabs/tear-off-tabs.tsx"use client"; import { useCallback, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode, type Ref, } from "react"; import { AnimatePresence, animate, motion, motionValue, useMotionValue, useReducedMotion, useTransform, type MotionValue, } from "motion/react"; import { IconSquareRoundedArrowUpFilled } from "@tabler/icons-react";
Adds the files to
components/uibrik/tear-off-tabs and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/tear-off-tabs.Usage
import { TearOffTabs } from "@/components/uibrik/tear-off-tabs/tear-off-tabs";const tabs = [ { id: "notes", title: "Notes", icon: <IconFileTextFilled />, content: <Page title="Notes" rows={[["Launch plan", "Edited 2m ago"], ["Hiring loop", "Yesterday"], ["Q1 goals", "Mon"], ["Pricing ideas", "Nov 28"]]} />, }, { id: "tasks", title: "Tasks", icon: <IconSquareCheckFilled />, content: <Page title="Tasks" rows={[["Ship onboarding flow", "Today"], ["Review billing copy", "Tomorrow"], ["Fix Safari tooltip", "Done"], ["Plan retro", "Fri"]]} />, }, // …2 more];<TearOffTabs height={360} threshold={36} tabs={tabs} windowSize={{ width: 300, height: 210 }}/>Where to use Tear-off Tabs
Editors and IDEs
Pull a file or panel out to see it beside another, then dock it back.
Pairs with Split Panes
Dashboards with many views
Keep a chart or chat floating while you work in another tab.
Browser-like apps
Reorder and detach pages the way people already do in their browser.
Props
TearOffTabs- height
- Type number
- 360
- Height of the page area.
- threshold
- Type number
- 36
- How far a tab is pulled down before it tears free.
- tabs
- Type { id; title; icon?; content }[]
- –
- The pages. A torn-off page shows in its window at windowSize.
- windowSize
- Type { width; height }
- { width: 300, height: 210 }
- Size of a torn-off window, px.
- className
- Type string
- –
- Classes for the frame.