Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bar List
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Checkbox Group
- Circular Progress
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Button
- Currency Input
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Meter
- Multi Combobox
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Phone Input
- Popover
- Progress
- Progress List
- Prompt
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
Password Input
A password input with a visibility toggle button.
Loading...
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { PasswordInput } from "@/components/ui/password-input";
export function PasswordInputDemo() {
return (
<Field>
<FieldLabel htmlFor="password-input-demo">Password</FieldLabel>
<PasswordInput
autoComplete="current-password"
id="password-input-demo"
placeholder="Enter your password"
/>
<FieldDescription>Click the eye icon to reveal your password.</FieldDescription>
</Field>
);
}Installation
npx shadcn@latest add "https://ui.blode.co/r/styles/default/password-input"
Usage
import { PasswordInput } from "@/components/ui/password-input";<PasswordInput placeholder="Enter your password" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
showPassword | boolean | - | Controlled visibility state. |
defaultShowPassword | boolean | false | Initial visibility state (uncontrolled). |
onShowPasswordChange | (showPassword: boolean) => void | - | Callback when visibility is toggled. |
className | string | - | Class name applied to the input. |
hasError | boolean | false | Shows error state with a destructive border. |
clearable | boolean | false | Enables a clear button when value is present. |
onClear | () => void | - | Callback fired when the clear button is clicked. |
leftAddon | React.ReactNode | - | Content displayed before the input field. |
rightAddon | React.ReactNode | - | Content displayed after the input field. |
disabled | boolean | false | Disables the input and toggle button. |
Examples
Default
Loading...
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { PasswordInput } from "@/components/ui/password-input";
export function PasswordInputDemo() {
return (
<Field>
<FieldLabel htmlFor="password-input-demo">Password</FieldLabel>
<PasswordInput
autoComplete="current-password"
id="password-input-demo"
placeholder="Enter your password"
/>
<FieldDescription>Click the eye icon to reveal your password.</FieldDescription>
</Field>
);
}