BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ericts-ui/expandable-segmented-tabs

Expandable Segmented Tabs

ericts-ui/expandable-segmented-tabs
FreeComponent

A Motion-powered segmented tab list for switching modes or views, with an active tab that expands from icon-only into a label.

Live preview

live · rendered by the registry
Rendered by ericts-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.ericts.com/r/expandable-segmented-tabs.json

Source

registry/base/ui/expandable-segmented-tabs.tsxui.ericts.com/r/expandable-segmented-tabs.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import {
5 AnimatePresence,
6 motion,
7 useReducedMotion,
8 type Transition,
9} from "motion/react";
10
11import { cn } from "@/lib/utils";
12
13export type ExpandableSegmentedTabsItem = {
14 value: string;
15 label: React.ReactNode;
16 icon: React.ReactNode;
17 disabled?: boolean;
18 ariaLabel?: string;
19};
20
21export type ExpandableSegmentedTabsProps = Omit<
22 React.ComponentProps<"div">,
23 "defaultValue" | "onChange"
24> & {
25 items: ExpandableSegmentedTabsItem[];
26 value?: string;
27 defaultValue?: string;
28 onValueChange?: (
29 value: string,
30 item: ExpandableSegmentedTabsItem,
31 ) => void;
32 onValueIntent?: (
33 value: string,
34 item: ExpandableSegmentedTabsItem,
35 ) => void;
36 /**
37 * Preserves the last selected value across unmount/remount for this key, so
38 * route-driven mode switches can still animate from the previous tab.
39 */
40 transitionKey?: string | null;
41 listClassName?: string;
42 itemClassName?: string;
43 activeItemClassName?: string;
44 iconClassName?: string;
45 labelClassName?: string;
46 indicatorClassName?: string;
47 "aria-label"?: string;
48};
49
50type FlexTarget = {
51 flexGrow: number;
52 flexShrink: number;
53 flexBasis: string;
54};
55
56const EXPAND_TRANSITION: Transition = {
57 duration: 0.28,
58 ease: [0.77, 0, 0.175, 1],
59};
60
61const ACTIVE_FLEX: FlexTarget = {
62 flexGrow: 1,
63 flexShrink: 1,
64 flexBasis: "0px",
65};
66
67const INACTIVE_FLEX: FlexTarget = {
68 flexGrow: 0,
69 flexShrink: 0,
70 flexBasis: "2.25rem",
71};
72
73const selectedValueByTransitionKey = new Map<string, string>();
74
75function getEnabledItems(items: ExpandableSegmentedTabsItem[]) {
76 return items.filter((item) => !item.disabled);
77}
78
79function getSelectableValue(
80 items: ExpandableSegmentedTabsItem[],
81 value: string | undefined,
82) {
83 const enabledItems = getEnabledItems(items);
84
85 return enabledItems.some((item) => item.value === value)
86 ? value
87 : enabledItems[0]?.value;
88}
89
90function getItemByValue(
91 items: ExpandableSegmentedTabsItem[],
92 value: string,
93) {
94 return items.find((item) => item.value === value);
95}
96
97export function ExpandableSegmentedTabs({
98 items,
99 value,
100 defaultValue,
101 onValueChange,
102 onValueIntent,
103 transitionKey,
104 className,
105 listClassName,
106 itemClassName,
107 activeItemClassName,
108 iconClassName,
109 labelClassName,
110 indicatorClassName,
111 "aria-label": ariaLabel = "Options",
112 ...props
113}: ExpandableSegmentedTabsProps) {
114 const shouldReduceMotion = useReducedMotion();
115 const isControlled = value !== undefined;
116// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • registry/base/ui/expandable-segmented-tabs.tsx

Facts

Registry
ericts-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-15
Last confirmed
today

Go to the source

Docs on ericts-ui ui.ericts.com EricTsai83/ericts-ui on GitHub Raw registry item This item as JSON

More from ericts-ui

All 43 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Adaptive Draweradaptive-drawerericts-uiComponentsFree2 deps
Adaptive Switchadaptive-switchericts-uiComponentsFree2 deps
Check Markcheck-markericts-uiComponentsFreeno deps · 2 files
Context Cursorcontext-cursorericts-uiComponentsFree1 dep
Copy Buttoncopy-buttonericts-uiComponentsFree2 deps
Expandable Dialogexpandable-dialogericts-uiComponentsFree1 dep
Expandable Panelexpandable-panelericts-uiComponentsFree2 deps
Expandable Sliderexpandable-sliderericts-uiComponentsFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex