Skip to content

Commit

Permalink
add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
day-mon committed Jan 20, 2024
1 parent 0b094b1 commit c9d3da8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ui/src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { splitProps, type Component } from "solid-js"

import { Tooltip as TooltipPrimitive } from "@kobalte/core"

import { cn } from "~/lib/utils"

const Tooltip: Component<TooltipPrimitive.TooltipRootProps> = (props) => {
return <TooltipPrimitive.Root gutter={4} {...props} />
}

const TooltipTrigger = TooltipPrimitive.Trigger

const TooltipContent: Component<TooltipPrimitive.TooltipContentProps> = (props) => {
const [, rest] = splitProps(props, ["class"])
return (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
class={cn(
"bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 z-50 origin-[var(--kb-popover-content-transform-origin)] overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md",
props.class
)}
{...rest}
/>
</TooltipPrimitive.Portal>
)
}

export { Tooltip, TooltipTrigger, TooltipContent }

0 comments on commit c9d3da8

Please sign in to comment.