BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/dedevs-ui/ai-branch

ai-branch

dedevs-ui/ai-branch
FreeComponent

AI conversation branch component for displaying branched conversations

See it running

Open the demo on dedevs-ui

ui.dedevs.com/components/ai-branch
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://ui.dedevs.com/r/ai-branch.json

Source

packages/ai/branch.tsxui.dedevs.com/r/ai-branch.json
1'use client';
2
3import { ChevronLeft, ChevronRight } from 'lucide-react';
4import type { HTMLAttributes, ReactElement, ReactNode } from 'react';
5import { createContext, useContext, useEffect, useState } from 'react';
6import { Button } from '@repo/shadcn-ui/components/ui/button';
7import { cn } from '@repo/shadcn-ui/lib/utils';
8
9type AIBranchContextType = {
10 currentBranch: number;
11 totalBranches: number;
12 goToPrevious: () => void;
13 goToNext: () => void;
14 branches: ReactElement[];
15 setBranches: (branches: ReactElement[]) => void;
16};
17
18const AIBranchContext = createContext<AIBranchContextType | null>(null);
19
20const useAIBranch = () => {
21 const context = useContext(AIBranchContext);
22
23 if (!context) {
24 throw new Error('AIBranch components must be used within AIBranch');
25 }
26
27 return context;
28};
29
30export type AIBranchProps = HTMLAttributes<HTMLDivElement> & {
31 defaultBranch?: number;
32 onBranchChange?: (branchIndex: number) => void;
33};
34
35export const AIBranch = ({
36 defaultBranch = 0,
37 onBranchChange,
38 className,
39 ...props
40}: AIBranchProps) => {
41 const [currentBranch, setCurrentBranch] = useState(defaultBranch);
42 const [branches, setBranches] = useState<ReactElement[]>([]);
43
44 const handleBranchChange = (newBranch: number) => {
45 setCurrentBranch(newBranch);
46 onBranchChange?.(newBranch);
47 };
48
49 const goToPrevious = () => {
50 const newBranch =
51 currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
52 handleBranchChange(newBranch);
53 };
54
55 const goToNext = () => {
56 const newBranch =
57 currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
58 handleBranchChange(newBranch);
59 };
60
61 const contextValue: AIBranchContextType = {
62 currentBranch,
63 totalBranches: branches.length,
64 goToPrevious,
65 goToNext,
66 branches,
67 setBranches,
68 };
69
70 return (
71 <AIBranchContext.Provider value={contextValue}>
72 <div
73 className={cn('grid w-full gap-2 [&>div]:pb-0', className)}
74 {...props}
75 />
76 </AIBranchContext.Provider>
77 );
78};
79
80export type AIBranchMessagesProps = {
81 children: ReactElement | ReactElement[];
82};
83
84export const AIBranchMessages = ({ children }: AIBranchMessagesProps) => {
85 const { currentBranch, setBranches, branches } = useAIBranch();
86 const childrenArray = Array.isArray(children) ? children : [children];
87
88 // Use useEffect to update branches when they change
89 useEffect(() => {
90 if (branches.length !== childrenArray.length) {
91 setBranches(childrenArray);
92 }
93// … truncated

Files it writes

  • packages/ai/branch.tsx

Facts

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

Go to the source

Docs on dedevs-ui ui.dedevs.com DeDevsClub/dedevs-ui on GitHub Raw registry item This item as JSON

More from dedevs-ui

All 30 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-conversationai-conversationdedevs-uiComponentsFreeno deps
ai-inputai-inputdedevs-uiComponentsFreeno deps
ai-messageai-messagededevs-uiComponentsFreeno deps
ai-reasoningai-reasoningdedevs-uiComponentsFreeno deps
ai-responseai-responsededevs-uiComponentsFreeno deps
ai-serverai-serverdedevs-uiComponentsFreeno deps
ai-simpleai-simplededevs-uiComponentsFreeno deps
ai-sourceai-sourcededevs-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