Password Input
带显示 / 隐藏切换按钮的密码输入框,可作为表单控件使用。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
Other devices are signed out after the change.
<div class="demo-stack" style="max-width: 24rem">
<div soneField>
<label soneFieldLabel for="demo-current-password">Current password</label>
<sone-password-input inputId="demo-current-password" [(value)]="current" />
</div>
<div soneField [invalid]="tooShort()">
<label soneFieldLabel for="demo-new-password">New password</label>
<sone-password-input inputId="demo-new-password" autocomplete="new-password"
placeholder="At least 8 characters" [(value)]="next" [invalid]="tooShort()" />
@if (tooShort()) {
<p soneFieldError>Use at least 8 characters.</p>
} @else {
<p soneFieldDescription>Other devices are signed out after the change.</p>
}
</div>
</div>导入
import {
SonePasswordInputComponent,
} from "@surface-one/angular/password-input";API 参考
SonePasswordInputComponent组件
A password field with a show / hide toggle, on the Input Group. The toggle is a toggle button: a constant name ("Show password") and `aria-pressed`.
| 名称 | 类型 | 默认值 |
|---|---|---|
value双向 | string | "" |
visible双向Shows the password as plain text (`[(visible)]`). | boolean | false |
autocomplete | PasswordAutocomplete | "current-password" |
placeholder | string | "" |
inputId | string | null | null |
name | string | null | null |
ariaLabel | string | null | null |
ariaDescribedbyExtra ids for `aria-describedby` on the input. | string | null | null |
invalid | boolean | false |
disabled | boolean | false |
readonly | boolean | false |
toggleLabelThe toggle's accessible name; its state is `aria-pressed`. | — | $localize`Show password` |