docs/components/password-input
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
A field for entering secure text.
PreviewCode
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/password-input
PasswordInput
└── PasswordInputGroup
├── PasswordInputInput
└── PasswordInputTrigger
import {
PasswordInput,
PasswordInputGroup,
PasswordInputInput,
PasswordInputTrigger,
} from "@/components/ui/password-input";
<PasswordInput>
<PasswordInputGroup>
<PasswordInputInput placeholder="Enter password" />
<PasswordInputTrigger />
</PasswordInputGroup>
</PasswordInput>
Use value and onChange on PasswordInputInput to control the password value.
PreviewCode
Character count: 0
Use the disabled prop to disable the password input.
PreviewCode
Password
The field is currently disabled.
Use the invalid prop to mark the password input as invalid.
PreviewCode
Password
Please enter a valid password.
Use the size prop to change the input height.
PreviewCode
PreviewCode
PreviewCode
Use the autoComplete prop to hint autofill behavior to the browser.
current-password — signing in with an existing passwordnew-password — creating or resetting a passwordPreviewCode
Current password
For signing in to an existing account.
New password
For creating or resetting a password.
Use visible and onVisibilityChange to control whether the value is shown.
PreviewCode
Use visible, onVisibilityChange, and a timer to hide the password again after it is revealed.
PreviewCode
PreviewCode
Combine with Field components, for labeled password fields with helper text.
PreviewCode
Password
Must be at least 8 characters.
Root component. Manages visibility and input state.
| Prop | Type | Default |
|---|---|---|
size | `"sm" | "md" |
autoComplete | `"current-password" | "new-password"` |
defaultVisible | boolean | false |
visible | boolean | - |
disabled | boolean | - |
invalid | boolean | - |
readOnly | boolean | - |
required | boolean | - |
name | string | - |
ignorePasswordManagers | boolean | - |
onVisibilityChange | (details: VisibilityChangeDetails) => void | - |
className | string | - |
asChild | boolean | false |
Wraps the input and visibility trigger.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Password field.
| Prop | Type | Default |
|---|---|---|
size | `"sm" | "md" |
className | string | - |
asChild | boolean | false |
Button that toggles visibility.
| Prop | Type | Default |
|---|---|---|
className | string | - |
Renders different icons based on visibility. Use fallback for the hidden state and pass the visible-state icon as children.
| Prop | Type | Default |
|---|---|---|
fallback | React.ReactNode | <EyeOffIcon /> |
children | React.ReactNode | <EyeIcon /> |
className | string | - |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Pagination ](/docs/components/pagination)[
Next page
Popover ](/docs/components/popover)
On This Page
InstallationAnatomyUsageControlledStatesDisabledInvalidSizesSmallMediumLargeExamplesAutocompleteControlled VisibilityAuto HideCustom IndicatorWith FieldAPI ReferencePasswordInputPasswordInputGroupPasswordInputInputPasswordInputTriggerPasswordInputIndicator