ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Installation#

Run the following command:

npx shadcn@latest add @rescript-shadcn/Tooltip

Add the Tooltip.Provider to the root of your app.

app/layout.res
module RootLayout = {
  @react.component
  let make = (~children) =>
    <html lang="en">
      <body>
        <Tooltip.Provider>{children}</Tooltip.Provider>
      </body>
    </html>
}

Usage#

<Tooltip>
  <Tooltip.Trigger render={<Button variant=Outline />}>
    {"Hover"->React.string}
  </Tooltip.Trigger>
  <Tooltip.Content>
    <p> {"Add to library"->React.string} </p>
  </Tooltip.Content>
</Tooltip>

Examples#

Side#

Use the side prop to change the position of the tooltip.

With Keyboard Shortcut#

Disabled Button#

Show a tooltip on a disabled button by wrapping it with a span.

API Reference#

See the Base UI Tooltip documentation.

@react.component
let make = () =>
  <Tooltip>
let tooltipSides = [
  BaseUi.Types.Side.Left,
  BaseUi.Types.Side.Top,
module LucideIcons = {
  type props = {className?: string, @as("data-icon") dataIcon?: string}
@react.component
let make = () =>
  <Tooltip>