Mohamed Uvaish

Tooltip

Component

About

Tooltip with a keyboard shortcut beside the label, shown on hover and focus. A provider skips the delay along a toolbar. Part of the Layro System: layro.vercel.app.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tooltip to your project and fits it to your theme.

Code

How Tooltip is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react";
import { Tooltip, TooltipProvider } from "@/components/ui/layro-tooltip";
import { Copy, Settings, Trash2, ZoomIn, Share2 } from "lucide-react";

/* Short labels for icon buttons, with the shortcut beside them. Inside a
   TooltipProvider, moving along the toolbar skips the delay, and focus
   opens a tooltip as well as hover. */

export default function TooltipDemo() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center bg-background p-6">
      <TooltipProvider>
        <div role="toolbar" aria-label="Document" className="flex items-center gap-1 rounded-[14px] [corner-shape:squircle] bg-card p-1.5 ring-1 ring-border">
          {[["Duplicate", "⌘D", Copy], ["Share", "⌘⇧S", Share2], ["Zoom in", "⌘+", ZoomIn], ["Settings", "⌘,", Settings], ["Delete", undefined, Trash2]].map(([label, keys, I]: any) => (
            <Tooltip key={label} label={label} keys={keys}>
              <button type="button" aria-label={label} className="grid size-9 place-items-center rounded-[10px] [corner-shape:squircle] text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
                <I className="size-4" />
              </button>
            </Tooltip>
          ))}
        </div>
      </TooltipProvider>
    </div>
  );
}

Dependencies

More by Mohamed Uvaish

View all
  • Signature Pad

    Signature Pad

    420
  • Folder Card

    Folder Card

    336
  • Share Dialog

    Share Dialog

    308
  • Kanban Board

    Kanban Board

    249
  • Notification Panel

    Notification Panel

    102
  • Charts & KPI Cards

    Charts & KPI Cards

    87
  • Rich Text Editor

    Rich Text Editor

    44
  • Command Menu

    Command Menu

    35

Explore more

Part of Layro System — browse the full library on 21st.dev.