Home / File/ hover-card-example.tsx — ui Source File

hover-card-example.tsx — ui Source File

Architecture documentation for hover-card-example.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  d884b3df_97c2_1c2a_bb55_0448a1ae3f68["hover-card-example.tsx"]
  da02b53a_0c1d_d1a1_af31_74d99f1cdd7a["example"]
  d884b3df_97c2_1c2a_bb55_0448a1ae3f68 --> da02b53a_0c1d_d1a1_af31_74d99f1cdd7a
  381135fe_5f7a_910a_b8a2_691e9756a016["button"]
  d884b3df_97c2_1c2a_bb55_0448a1ae3f68 --> 381135fe_5f7a_910a_b8a2_691e9756a016
  ee16c284_c278_b787_3146_67666cbd8485["dialog"]
  d884b3df_97c2_1c2a_bb55_0448a1ae3f68 --> ee16c284_c278_b787_3146_67666cbd8485
  ee9936ed_b4d3_db22_9bc0_e8bdaf8568b0["hover-card"]
  d884b3df_97c2_1c2a_bb55_0448a1ae3f68 --> ee9936ed_b4d3_db22_9bc0_e8bdaf8568b0
  style d884b3df_97c2_1c2a_bb55_0448a1ae3f68 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
  Example,
  ExampleWrapper,
} from "@/registry/bases/radix/components/example"
import { Button } from "@/registry/bases/radix/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/registry/bases/radix/ui/dialog"
import {
  HoverCard,
  HoverCardContent,
  HoverCardTrigger,
} from "@/registry/bases/radix/ui/hover-card"

export default function HoverCardExample() {
  return (
    <ExampleWrapper>
      <HoverCardSides />
      <HoverCardInDialog />
    </ExampleWrapper>
  )
}

const HOVER_CARD_SIDES = ["top", "right", "bottom", "left"] as const

function HoverCardSides() {
  return (
    <Example title="Sides">
      <div className="flex flex-wrap items-center justify-center gap-4">
        {HOVER_CARD_SIDES.map((side) => (
          <HoverCard key={side} openDelay={100} closeDelay={100}>
            <HoverCardTrigger asChild>
              <Button variant="outline" className="capitalize">
                {side}
              </Button>
            </HoverCardTrigger>
            <HoverCardContent side={side} className="w-64">
              <div className="style-lyra:gap-1 style-nova:gap-1.5 style-vega:gap-2 style-maia:gap-2 style-mira:gap-1 flex flex-col">
                <h4 className="font-medium">Hover Card</h4>
                <p>
                  This hover card appears on the {side} side of the trigger.
                </p>
              </div>
            </HoverCardContent>
          </HoverCard>
        ))}
      </div>
    </Example>
  )
}

function HoverCardInDialog() {
  return (
    <Example title="In Dialog">
      <Dialog>
        <DialogTrigger asChild>
          <Button variant="outline">Open Dialog</Button>
        </DialogTrigger>
        <DialogContent>
          <DialogHeader>
            <DialogTitle>Hover Card Example</DialogTitle>
            <DialogDescription>
              Hover over the button below to see the hover card.
            </DialogDescription>
          </DialogHeader>
          <HoverCard openDelay={100} closeDelay={100}>
            <HoverCardTrigger asChild>
              <Button variant="outline" className="w-fit">
                Hover me
              </Button>
            </HoverCardTrigger>
            <HoverCardContent className="w-64">
              <div className="style-lyra:gap-1 style-nova:gap-1.5 style-vega:gap-2 style-maia:gap-2 style-mira:gap-1 flex flex-col">
                <h4 className="font-medium">Hover Card</h4>
                <p>
                  This hover card appears inside a dialog. Hover over the button
                  to see it.
                </p>
              </div>
            </HoverCardContent>
          </HoverCard>
        </DialogContent>
      </Dialog>
    </Example>
  )
}

Subdomains

Dependencies

  • button
  • dialog
  • example
  • hover-card

Frequently Asked Questions

What does hover-card-example.tsx do?
hover-card-example.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in hover-card-example.tsx?
hover-card-example.tsx defines 3 function(s): HoverCardExample, HoverCardInDialog, HoverCardSides.
What does hover-card-example.tsx depend on?
hover-card-example.tsx imports 4 module(s): button, dialog, example, hover-card.
Where is hover-card-example.tsx in the architecture?
hover-card-example.tsx is located at apps/v4/registry/bases/radix/examples/hover-card-example.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/bases/radix/examples).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free