Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Input Group examples · Tooltip

API Key Info Input Group for React

An API key input with an info button whose tooltip says where to find the key.

Framework
UI library

Answer the question before it's asked: an info button at the end of the API key field opens a Tooltip, Found in your account settings. The key is masked with type="password".

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How is the info button tied to the tooltip?

TooltipTrigger renders the InputGroupButton through render, inside a TooltipProvider.

What is the button called?

Where to find your API key, from its aria-label; the icon is aria-hidden.

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.

Why is the key masked?

type="password" hides a secret from people looking at the screen. Add a show button if people need to check it.

Where is the button?

In an inline-end InputGroupAddon after the input.

How is the input labeled?

aria-label="API key".