stepper
diceui-radix/stepperFreeComponent
diceui/radix publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/stepper.jsonSource
1"use client";23import { Check } from "lucide-react";4import {5 Direction as DirectionPrimitive,6 Slot as SlotPrimitive,7} from "radix-ui";8import * as React from "react";9import { useComposedRefs } from "@/lib/compose-refs";10import { cn } from "@/lib/utils";11import { useAsRef } from "@/registry/bases/radix/hooks/use-as-ref";12import { useIsomorphicLayoutEffect } from "@/registry/bases/radix/hooks/use-isomorphic-layout-effect";13import { useLazyRef } from "@/registry/bases/radix/hooks/use-lazy-ref";1415const ROOT_NAME = "Stepper";16const LIST_NAME = "StepperList";17const ITEM_NAME = "StepperItem";18const TRIGGER_NAME = "StepperTrigger";19const INDICATOR_NAME = "StepperIndicator";20const SEPARATOR_NAME = "StepperSeparator";21const TITLE_NAME = "StepperTitle";22const DESCRIPTION_NAME = "StepperDescription";23const CONTENT_NAME = "StepperContent";24const PREV_NAME = "StepperPrev";25const NEXT_NAME = "StepperNext";2627const ENTRY_FOCUS = "stepperFocusGroup.onEntryFocus";28const EVENT_OPTIONS = { bubbles: false, cancelable: true };29const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];3031type Direction = "ltr" | "rtl";32type Orientation = "horizontal" | "vertical";33type NavigationDirection = "next" | "prev";34type ActivationMode = "automatic" | "manual";35type DataState = "inactive" | "active" | "completed";3637interface DivProps extends React.ComponentProps<"div"> {38 asChild?: boolean;39}40interface ButtonProps extends React.ComponentProps<"button"> {41 asChild?: boolean;42}4344type ListElement = React.ComponentRef<typeof StepperList>;45type TriggerElement = React.ComponentRef<typeof StepperTrigger>;4647function getId(48 id: string,49 variant: "trigger" | "content" | "title" | "description",50 value: string,51) {52 return `${id}-${variant}-${value}`;53}5455type FocusIntent = "first" | "last" | "prev" | "next";5657const MAP_KEY_TO_FOCUS_INTENT: Record<string, FocusIntent> = {58 ArrowLeft: "prev",59 ArrowUp: "prev",60 ArrowRight: "next",61 ArrowDown: "next",62 PageUp: "first",63 Home: "first",64 PageDown: "last",65 End: "last",66};6768function getDirectionAwareKey(key: string, dir?: Direction) {69 if (dir !== "rtl") return key;70 return key === "ArrowLeft"71 ? "ArrowRight"72 : key === "ArrowRight"73 ? "ArrowLeft"74 : key;75}7677function getFocusIntent(78 event: React.KeyboardEvent<TriggerElement>,79 dir?: Direction,80 orientation?: Orientation,81) {82 const key = getDirectionAwareKey(event.key, dir);83// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from diceui/radix
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-baraction-bar | diceui/radix | Components | Free | 1 dep · 2 files | |
| angle-sliderangle-slider | diceui/radix | Components | Free | 1 dep · 3 files | |
| avatar-groupavatar-group | diceui/radix | Components | Free | 1 dep | |
| badge-overflowbadge-overflow | diceui/radix | Components | Free | 1 dep · 2 files | |
| bannerbanner | diceui/radix | Components | Free | 1 dep | |
| checkbox-groupcheckbox-group | diceui/radix | Components | Free | 1 dep | |
| circular-progresscircular-progress | diceui/radix | Components | Free | 1 dep | |
| client-onlyclient-only | diceui/radix | Components | Free | no deps |
