Hover Card
draco-china-github/hover-card-exampleFreeExample
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/draco-china/shadcn-pro/main/apps/docs/public/r/styles/radix-sera/hover-card-example.jsonSource
1import {2 Example,3 ExampleWrapper,4} from "@/registry/radix-sera/components/example"5import { Button } from "@/registry/radix-sera/ui/button"6import {7 Dialog,8 DialogContent,9 DialogDescription,10 DialogHeader,11 DialogTitle,12 DialogTrigger,13} from "@/registry/radix-sera/ui/dialog"14import {15 HoverCard,16 HoverCardContent,17 HoverCardTrigger,18} from "@/registry/radix-sera/ui/hover-card"1920export default function HoverCardExample() {21 return (22 <ExampleWrapper>23 <HoverCardSides />24 <HoverCardInDialog />25 </ExampleWrapper>26 )27}2829const HOVER_CARD_SIDES = ["top", "right", "bottom", "left"] as const3031function HoverCardSides() {32 return (33 <Example title="Sides">34 <div className="flex flex-wrap items-center justify-center gap-4">35 {HOVER_CARD_SIDES.map((side) => (36 <HoverCard key={side} openDelay={100} closeDelay={100}>37 <HoverCardTrigger asChild>38 <Button39 variant="outline"40 className="capitalize style-sera:uppercase"41 >42 {side}43 </Button>44 </HoverCardTrigger>45 <HoverCardContent side={side} className="w-64">46 <div className="flex flex-col style-vega:gap-2 style-nova:gap-1.5 style-lyra:gap-1 style-maia:gap-2 style-mira:gap-1 style-luma:gap-2 style-sera:gap-2">47 <h4 className="font-medium style-sera:font-heading style-sera:font-semibold style-sera:tracking-wide">48 Hover Card49 </h4>50 <p className="style-sera:leading-relaxed">51 This hover card appears on the {side} side of the trigger.52 </p>53 </div>54 </HoverCardContent>55 </HoverCard>56 ))}57 </div>58 </Example>59 )60}6162function HoverCardInDialog() {63 return (64 <Example title="In Dialog">65 <Dialog>66 <DialogTrigger asChild>67 <Button variant="outline">Open Dialog</Button>68 </DialogTrigger>69 <DialogContent>70 <DialogHeader>71 <DialogTitle>Hover Card Example</DialogTitle>72 <DialogDescription>73 Hover over the button below to see the hover card.74 </DialogDescription>75 </DialogHeader>76 <HoverCard openDelay={100} closeDelay={100}>77 <HoverCardTrigger asChild>78 <Button variant="outline" className="w-fit">79 Hover me80 </Button>81// … truncated
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 201 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion-example | shadcn/ui | Examples | Free | no deps | |
| Alert Dialogalert-dialog-example | shadcn/ui | Examples | Free | no deps | |
| Alertalert-example | shadcn/ui | Examples | Free | no deps | |
| Aspect Ratioaspect-ratio-example | shadcn/ui | Examples | Free | no deps | |
| Avataravatar-example | shadcn/ui | Examples | Free | no deps | |
| Badgebadge-example | shadcn/ui | Examples | Free | no deps | |
| Breadcrumbbreadcrumb-example | shadcn/ui | Examples | Free | no deps | |
| Buttonbutton-example | shadcn/ui | Examples | Free | no deps |
