speed-dial
diceui-radix/speed-dialFreeComponent
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/speed-dial.jsonSource
1"use client";23import { cva, type VariantProps } from "class-variance-authority";4import { Slot as SlotPrimitive } from "radix-ui";5import * as React from "react";6import { useComposedRefs } from "@/lib/compose-refs";7import { cn } from "@/lib/utils";8import { useAsRef } from "@/registry/bases/radix/hooks/use-as-ref";9import { useIsomorphicLayoutEffect } from "@/registry/bases/radix/hooks/use-isomorphic-layout-effect";10import { useLazyRef } from "@/registry/bases/radix/hooks/use-lazy-ref";11import { Button } from "@/registry/bases/radix/ui/button";1213const ROOT_NAME = "SpeedDial";14const TRIGGER_NAME = "SpeedDialTrigger";15const CONTENT_NAME = "SpeedDialContent";16const ITEM_NAME = "SpeedDialItem";17const ACTION_NAME = "SpeedDialAction";18const LABEL_NAME = "SpeedDialLabel";1920const ACTION_SELECT = "speedDial.actionSelect";21const INTERACT_OUTSIDE = "speedDial.interactOutside";22const EVENT_OPTIONS = { bubbles: true, cancelable: true };2324const DEFAULT_GAP = 8;25const DEFAULT_OFFSET = 8;26const DEFAULT_ITEM_DELAY = 50;27const DEFAULT_HOVER_CLOSE_DELAY = 100;28const DEFAULT_ANIMATION_DURATION = 200;2930type Side = "top" | "right" | "bottom" | "left";31type ActivationMode = "click" | "hover";3233interface DivProps extends React.ComponentProps<"div"> {34 asChild?: boolean;35}3637type RootElement = React.ComponentRef<typeof SpeedDial>;38type ContentElement = React.ComponentRef<typeof SpeedDialContent>;39type TriggerElement = React.ComponentRef<typeof SpeedDialTrigger>;40type ActionElement = React.ComponentRef<typeof SpeedDialAction>;4142interface InteractOutsideEvent extends CustomEvent {43 detail: {44 originalEvent: PointerEvent;45 };46}4748function getDataState(open: boolean): string {49 return open ? "open" : "closed";50}5152function getTransformOrigin(side: Side): string {53 switch (side) {54 case "top":55 return "bottom center";56 case "bottom":57 return "top center";58 case "left":59 return "right center";60 case "right":61 return "left center";62 }63}6465interface StoreState {66 open: boolean;67}6869interface Store {70 subscribe: (callback: () => void) => () => void;71 getState: () => StoreState;72 setState: <K extends keyof StoreState>(key: K, value: StoreState[K]) => void;73 notify: () => void;74}7576const StoreContext = React.createContext<Store | null>(null);7778function useStoreContext(consumerName: string) {79 const context = React.useContext(StoreContext);80 if (!context) {81 throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);82 }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 |
