Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Password Requirements Input Group for Vue

A password field and a confirm field, each with an info tooltip that states its own password rule.

UI library: Ark UI

Two masked password fields. Each has an info button. The first tooltip says the password must be at least 8 characters. The second says to enter the same password as above. Nothing checks either rule.

Keep a short rule next to the field it covers. A hover note that does not need a portal is a Hint. In Vue, Ark UI does not check the password against the tooltip.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Input Group anatomy: root, addon, input, text, button

Usage

<div class="flex w-full max-w-sm flex-col gap-4">
  <InputGroup class="bg-background">
    <InputGroupInput aria-label="Password" placeholder="Enter password" type="password" />
    <InputGroupAddon align="inline-end">
      <Tooltip>
        <TooltipTrigger :asChild="true">
          <InputGroupButton aria-label="Password requirements" size="icon-xs" variant="ghost">
            <InfoIcon aria-hidden="true" />
          </InputGroupButton>
        </TooltipTrigger>
        <TooltipContent><p>Password must be at least 8 characters</p></TooltipContent>
      </Tooltip>
    </InputGroupAddon>
  </InputGroup>
  <InputGroup class="bg-background">
    <InputGroupInput
      aria-label="Confirm password"
      placeholder="Confirm password"
      type="password"
    />
    <InputGroupAddon align="inline-end">
      <Tooltip>
        <TooltipTrigger :asChild="true">
          <InputGroupButton
            aria-label="Confirm password requirements"
            size="icon-xs"
            variant="ghost"
          >
            <InfoIcon aria-hidden="true" />
          </InputGroupButton>
        </TooltipTrigger>
<!-- The rest of the file is under Installation. -->

FAQ

How is each info button tied to its tooltip?

TooltipTrigger takes asChild, so the InputGroupButton itself is the trigger.

How are the two buttons told apart?

Their aria-labels, Password requirements and Confirm password requirements.

Should the rules be in a tooltip?

Only as a hint. Rules people must meet are better shown under the field, where touch users and screen readers find them without hovering.

Does the form check the rules?

No. Validate the length and that both fields match, and show an error under the field that fails.

Which autocomplete values should these inputs have?

autoComplete="new-password" on both, so password managers offer a strong password and save it.

How are the two fields spaced?

A column with gap-4, capped at max-w-sm.

API Reference

Input Group

Sets aria-label="Password", placeholder="Enter password", type="password", align="inline-end", aria-label="Password requirements" and size="icon-xs". The rest is on the Input Group page.

Tooltip

Sets asChild. The rest is on the Tooltip page.