shadcn.io is an independent project built on shadcn/ui
The API key field is masked. An info button at the end opens a tooltip that reads Found in your account settings. The button is named Where to find your API key.
Put the hint on the field when people keep asking where a value comes from. A longer explanation belongs in a Dialog. In React, Base UI does not copy the tooltip text into the field.
Installation
Anatomy

Usage
<InputGroup className="w-full max-w-sm bg-background">
<InputGroupInput
aria-label="API key"
placeholder="API key"
type="password"
/>
<InputGroupAddon align="inline-end">
<TooltipProvider>
<Tooltip>
<TooltipTrigger
render={
<InputGroupButton
aria-label="Where to find your API key"
size="icon-xs"
variant="ghost"
/>
}
>
<InfoIcon aria-hidden="true" />
</TooltipTrigger>
<TooltipContent>
<p>Found in your account settings</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</InputGroupAddon>
</InputGroup>FAQ
How is the info button tied to the tooltip?
TooltipTrigger renders the InputGroupButton through render, inside a TooltipProvider.When does the tooltip show?
On hover and keyboard focus of the button. Escape closes it. Touch screens don't hover, so keep essential help visible.
API Reference
Input Group
Sets aria-label="API key", placeholder="API key", type="password", align="inline-end", aria-label="Where to find your API key" and size="icon-xs". The rest is on the Input Group page.
Tooltip
No extra props in this demo. The rest is on the Tooltip page.





